Advertisement
yovkovbpfps

Simple Operation and Calculation Alcohol Market

Apr 19th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Exercise1002 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double priceofWhiskiinBGN = Double.parseDouble(scanner.nextLine());
  8. double BeerinLiters = Double.parseDouble(scanner.nextLine());
  9. double WineinLiters = Double.parseDouble(scanner.nextLine());
  10. double RakiainLiters = Double.parseDouble(scanner.nextLine());
  11. double WhiskeyinLiters = Double.parseDouble(scanner.nextLine());
  12.  
  13.  
  14. double priceofRakia = priceofWhiskiinBGN /2;
  15. double priceofBeer = priceofRakia -priceofRakia *0.8;
  16. double priceofWine =priceofRakia -priceofRakia * 0.4;
  17. double totalWiskyeprice = priceofWhiskiinBGN * WhiskeyinLiters;
  18. double totalrakiaprice = priceofRakia * RakiainLiters;
  19. double toralwineprice = priceofWine * WineinLiters;
  20. double totalbeerprice = priceofBeer * BeerinLiters;
  21.  
  22. double total = totalWiskyeprice + toralwineprice + totalbeerprice + totalrakiaprice;
  23.  
  24. System.out.printf("%.2f",total);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement