Advertisement
stoyanoff

alabala

Jul 2nd, 2020
800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.64 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FruitMarket {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double strawberrypriceperkg = Double.parseDouble(scanner.nextLine()); //cena za kilogram
  8.  
  9.         double amountofthebannanasinkg = Double.parseDouble(scanner.nextLine()); //kolichestvo banani
  10.         double amountoftheorangesinkg = Double.parseDouble(scanner.nextLine()); //kolichestvo portokali
  11.         double amountoftheraspberriesinkg = Double.parseDouble(scanner.nextLine()); //kolichestvo malini
  12.         double amountofthestrawberriesinkg = Double.parseDouble(scanner.nextLine()); //kolichestvo qgodi
  13.  
  14.         //  цената на малините е с 50% по-ниска от тази на ягодите;
  15.         double raspberriesprice = strawberrypriceperkg / 2;
  16.         double raspberriespriceforkg = amountoftheraspberriesinkg * raspberriesprice ;
  17.  
  18.         // цената на портокалите е с 40% по-ниска от цената на малините;
  19.         double orangespriceforkg = raspberriesprice - raspberriesprice * 40 / 100;
  20.  
  21.         // цената на бананите е с 80% по-ниска от цената на малините.
  22.         double bannanaspriceforkg = raspberriesprice - raspberriesprice * 80 / 100;
  23.  
  24.         double strawberriespriceforkg = strawberrypriceperkg * amountofthestrawberriesinkg;//калк количество ягоди*цена
  25.  
  26.         System.out.println(raspberriespriceforkg + orangespriceforkg + bannanaspriceforkg + strawberriespriceforkg);
  27.         //System.out.println(strawberriesprice);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement