收益计算器的错误?

Mon*_*ezy 3 java

对Java来说还是新手,我的任务是为一个纸质男孩制作一个利润计算器,但是我收到了这个错误:

Enter the number of daily papers delivered: 50
Enter the number of Sunday papers delivered: 35
The amount collected for daily papers was: Exception in thread "main" java.util
IllegalFormatConversionException: d != java.lang.Double
    at java.util.Formatter$FormatSpecifier.failConversion(Unknown Source)
    at java.util.Formatter$FormatSpecifier.printInteger(Unknown Source)
    at java.util.Formatter$FormatSpecifier.print(Unknown Source)
    at java.util.Formatter.format(Unknown Source)
    at java.io.PrintStream.format(Unknown Source)
    at java.io.PrintStream.printf(Unknown Source)
    at lab2b_MontelWhite.main(lab2b_MontelWhite.java:24)
Run Code Online (Sandbox Code Playgroud)

这是我到目前为止:

//Paper Boy's Wages Calculator

import java.util.Scanner;
public abstract class lab2b
{
public static void main(String[] args)
{
        Scanner input = new Scanner( System.in);
        int x;
        int y;
        int result;

        System.out.print("Enter the number of daily papers delivered: ");
        x = input.nextInt();

        System.out.print("Enter the number of Sunday papers delivered: ");
        y = input.nextInt();
        double dailyResult = x * .3;

        System.out.printf("The amount collected for daily papers was: %d\n",
        dailyResult);
        int SundayResult = y * 1;

        System.out.printf("The amount collected for Sunday papers was: %d\n", 

        SundayResult);
        double totalResult = dailyResult + SundayResult;

        System.out.printf("The total amount of money collected was: %d\n",    

        totalResult);
        double ProfitResult = (SundayResult + dailyResult)/2;

        System.out.printf("The paper boy's profit is: %d\n", ProfitResult);
}
}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?我添加了双打,我更改了"结果"的名称.我只是不确定我做错了什么.

ars*_*jii 6

%d是十进制整数.使用%f双打.

您可以阅读文档中的格式字符串语法Formatter.