Advertisement
Kur23

7

Mar 7th, 2021
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. package FirstStepsInCoding.Exc.lab;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class FriutMarket {
  6.     public static void main(String[] args) {
  7.         Scanner s = new Scanner(System.in);
  8.  
  9.         double strawberryBGN = Double.parseDouble(s.nextLine());
  10.         double bananaKG = Double.parseDouble(s.nextLine());
  11.         double orangeKG = Double.parseDouble(s.nextLine());
  12.         double berryKG = Double.parseDouble(s.nextLine());
  13.         double strawberryKG = Double.parseDouble(s.nextLine());
  14.  
  15.         double berryBGN = Double.parseDouble(s.nextLine());
  16.  
  17.  
  18.         double orangeBGN = berryBGN - (0.4 * berryBGN);
  19.         double bananaBGN = berryBGN - (0.8 * berryBGN);
  20.         double berrySum = berryBGN * berryKG;
  21.         double orangeSum = orangeBGN * orangeKG;
  22.         double bananaSum = bananaBGN * bananaKG;
  23.         double strawberrySum = strawberryBGN * strawberryKG;
  24.         double totalSum = berrySum + orangeSum + bananaSum + strawberrySum;
  25.  
  26.         System.out.printf("%.4f", totalSum);
  27.  
  28.  
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement