Advertisement
desislava_topuzakova

Алкохолна Борса

Jan 19th, 2018
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Alcohol {
  4.     public static void main(String[] agrs) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         double whiskeyBGN = Double.parseDouble(scan.nextLine());
  8.         double beerLiters = Double.parseDouble(scan.nextLine());
  9.         double wineLiters = Double.parseDouble(scan.nextLine());
  10.         double rakiaLiters = Double.parseDouble(scan.nextLine());
  11.         double whiskeyLiters = Double.parseDouble(scan.nextLine());
  12.  
  13.         double priceRakia = whiskeyBGN / 2;
  14.         double priceWine = priceRakia - (0.4 * priceRakia);
  15.         double priceBeer = priceRakia - (0.8 * priceRakia);
  16.         double sumRakia = priceRakia * rakiaLiters;
  17.         double sumBeer = priceBeer * beerLiters;
  18.         double sumWine = priceWine * wineLiters;
  19.         double sumWhiskey = whiskeyBGN * whiskeyLiters;
  20.         double sum = sumBeer + sumRakia + sumWine + sumWhiskey;
  21.  
  22.         System.out.printf("%.2f", sum);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement