标签:mat util print double pack pre span lse 0.00
package com.company; import java.text.DecimalFormat; import java.util.Scanner; public class Main { public static void main(String[] args) { // write your code here Scanner sc = new Scanner(System.in); double x = sc.nextDouble(); double cost = 0; DecimalFormat df = new DecimalFormat("0.00"); if((x <= 50)&(x >= 0)){ cost = 0.53*x; }if(x > 50){ cost = 0.53*50+(x-50)*(0.05+0.53); }else if(x < 0){ System.out.println("Invalid Value!"); } System.out.println("cost = "+df.format(cost)); } }
标签:mat util print double pack pre span lse 0.00
原文地址:https://www.cnblogs.com/zhuzehua/p/9672761.html