Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass {
- public static void main(String args[]) {
- java.util.Scanner scanner = new java.util.Scanner(System.in);
- int orders = scanner.nextInt();
- double pricePerCapsule = 0.0;
- int days = 0;
- int capsules = 0;
- double calculatedStep = 0.0;
- double totalPriceOfCoffee = 0.0;
- for (int orderNum = 1; orderNum <= orders; orderNum++) {
- pricePerCapsule = scanner.nextDouble();
- days = scanner.nextInt();
- capsules = scanner.nextInt();
- calculatedStep = pricePerCapsule * days * capsules;
- totalPriceOfCoffee += calculatedStep;
- System.out.printf("The price for the coffee is: $%.2f\n",calculatedStep);
- }
- System.out.printf("Total: $%.2f",totalPriceOfCoffee);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement