Java 小白 某苹果商卖苹果有个不找零钱的习惯,苹果售价为每500克2.49元,苹果商输入顾客购买苹果的数量后,输出这些苹果的未经四舍五入的总价格与顾客的应付金额

import java.util.Scanner;

class IntFunction
{
     
    double Sell = 500;
    void yuio()
    {
     
        System.out.println("请输入苹果的数量");
        Scanner sc = new Scanner(System.in);
        double word = sc.nextDouble();
        double mokey = (word/Sell)*2.49;
        System.out.println(Math.rint(mokey));
        System.out.println(mokey);
    }
}
class Main
{
     
    public static void main(String[] args)
    {
     
        IntFunction a = new IntFunction();
        a.yuio();
    }
}

你可能感兴趣的:(java,编程,java)