Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ex07FruitMarket {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double priceKgStrawberries = Double.parseDouble(scanner.nextLine());
- double bananasQuantity = Double.parseDouble(scanner.nextLine());
- double orangesQuantity = Double.parseDouble(scanner.nextLine());
- double raspberriesQuantity = Double.parseDouble(scanner.nextLine());
- double strawberriesQuantity = Double.parseDouble(scanner.nextLine());
- double priceKgRaspberries = priceKgStrawberries * 0.5;
- double priceKgOranges = priceKgRaspberries * 0.6;
- double priceKgBananas = priceKgRaspberries * 0.2;
- double totalPrice = priceKgBananas * bananasQuantity
- + priceKgOranges * orangesQuantity
- + priceKgRaspberries * raspberriesQuantity
- + priceKgStrawberries * strawberriesQuantity;
- System.out.printf("%.2f", totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement