Advertisement
Spocoman

Fruit Market

Sep 7th, 2024
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double strawberriesPrice = Double.parseDouble(scanner.nextLine()),
  7.                 bananasKg = Double.parseDouble(scanner.nextLine()),
  8.                 orangesKg = Double.parseDouble(scanner.nextLine()),
  9.                 raspberriesKg = Double.parseDouble(scanner.nextLine()),
  10.                 strawberriesKg = Double.parseDouble(scanner.nextLine()),
  11.                 raspberriesPrice = strawberriesPrice / 2,
  12.                 orangesPrice = raspberriesPrice * 0.60,
  13.                 bananasPrice = raspberriesPrice / 5,
  14.                 totalSum = strawberriesPrice * strawberriesKg + bananasPrice * bananasKg
  15.                         + orangesPrice * orangesKg + raspberriesPrice * raspberriesKg;
  16.  
  17.         System.out.printf("%.2f", totalSum);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement