Problem 07. Alcohol Market
import java.util.Scanner;
public class Exercise1002 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double priceofWhiskiinBGN = Integer.parseInt(scanner.nextLine());
double BeerinLiters = Integer.parseInt(scanner.nextLine());
double WineinLiters = Integer.parseInt(scanner.nextLine());
double RakiainLiters = Integer.parseInt(scanner.nextLine());
double WhiskeyinLiters = Integer.parseInt(scanner.nextLine());
double priceofRakia = priceofWhiskiinBGN * 0.5;
double priceofBeer = priceofWhiskiinBGN * 0.2;
double priceofWine = priceofWhiskiinBGN * 0.6;
double totalWiskyeprice = priceofWhiskiinBGN * WhiskeyinLiters;
double totalrakiaprice = priceofRakia * RakiainLiters;
double toralwineprice = priceofWine * WineinLiters;
double totalbeerprice = priceofBeer * BeerinLiters;
double total = totalWiskyeprice + toralwineprice + totalbeerprice + totalrakiaprice;
System.out.printf("%.2f",total);
}
}
Exception in thread "main" java.lang.NumberFormatException: For input string: "3.5"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.base/java.lang.Integer.parseInt(Integer.java:652)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at Exercise1002.Exercise1002.main(Exercise1002.java:10)
Process finished with exit code 1
Голямо благодаря за бързия отговор!