Advertisement
paykova

AlcoholMarket

Oct 5th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class AlcoholExchange {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double priceWhiskey = Double.parseDouble(scanner.nextLine());
  8. double beerN = Double.parseDouble(scanner.nextLine());
  9. double wineN = Double.parseDouble(scanner.nextLine());
  10. double rakiaN = Double.parseDouble(scanner.nextLine());
  11. double whiskeyN = Double.parseDouble(scanner.nextLine());
  12. double priceBeer, priceRakia, priceWine, result;
  13.  
  14. priceRakia = priceWhiskey/2;
  15. priceBeer = priceRakia - 0.8*priceRakia;
  16. priceWine = priceRakia - 0.4*priceRakia;
  17.  
  18. result = priceWhiskey*whiskeyN + priceBeer*beerN + priceWine*wineN + priceRakia*rakiaN;
  19.  
  20. System.out.printf("%.2f", result);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement