Advertisement
veronikaaa86

AlcoholMarket

Oct 16th, 2017
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P01_AlcoholMarket {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double whiskeyPrice = Double.parseDouble(scanner.nextLine());
  8.         double beerLiter = Double.parseDouble(scanner.nextLine());
  9.         double wineLiter = Double.parseDouble(scanner.nextLine());
  10.         double rakiaLiter = Double.parseDouble(scanner.nextLine());
  11.         double whiskeyLiter = Double.parseDouble(scanner.nextLine());
  12.  
  13.         double rakiaPrice = whiskeyPrice/2;
  14.         double winePrice = rakiaPrice-(rakiaPrice*((double) 40/100));
  15.         double beerPrice = rakiaPrice-(rakiaPrice*((double) 80/100));
  16.  
  17.         double sumWhiskey = whiskeyPrice*whiskeyLiter;
  18.         double sumBeer = beerPrice*beerLiter;
  19.         double sumWine = winePrice*wineLiter;
  20.         double sumRakia = rakiaPrice*rakiaLiter;
  21.  
  22.         double allSum = sumWhiskey+sumBeer+sumWine+sumRakia;
  23.  
  24.         System.out.printf("%.2f", allSum);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement