Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package examPrep;
- import java.util.Scanner;
- public class P01FruitMarket {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double strawberryPrice = Double.parseDouble(scanner.nextLine());
- double bananasQuantity = Double.parseDouble(scanner.nextLine());
- double orangesQuantity = Double.parseDouble(scanner.nextLine());
- double raspberryQuantity = Double.parseDouble(scanner.nextLine());
- double strawberryQuantity = Double.parseDouble(scanner.nextLine());
- double raspberryPrice = strawberryPrice / 2;
- double orangesPrice = raspberryPrice * 0.6;
- double bananasPrice = raspberryPrice * 0.20;
- double allRaspberries = raspberryPrice * raspberryQuantity;
- double allStrawberries = strawberryPrice * strawberryQuantity;
- double allOranges = orangesPrice * orangesQuantity;
- double allBananas = bananasPrice * bananasQuantity;
- double totalSum = allRaspberries + allStrawberries + allOranges + allBananas;
- System.out.printf("%.2f", totalSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement