Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main2 {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- double strawberryPrice = Double.parseDouble(s.nextLine());
- double bananas = Double.parseDouble(s.nextLine());
- double oranges = Double.parseDouble(s.nextLine());
- double raspberries = Double.parseDouble(s.nextLine());
- double strawberries = Double.parseDouble(s.nextLine());
- double raspberryPrice = strawberryPrice * 0.5;
- double orangePrice = raspberryPrice * 0.6;
- double bananaPrice = raspberryPrice * 0.2;
- double sum = (strawberries * strawberryPrice) + (raspberries * raspberryPrice) + (bananas * bananaPrice) + (oranges * orangePrice);
- System.out.printf("%.2f", sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement