Advertisement
Guest User

Alcohol Market

a guest
Sep 14th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class AlcoholMarket {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double whisky = Double.parseDouble(scanner.nextLine());
  8. double beer = Double.parseDouble(scanner.nextLine());
  9. double wine = Double.parseDouble(scanner.nextLine());
  10. double rakia = Double.parseDouble(scanner.nextLine());
  11. double whiskyinLitres = Double.parseDouble(scanner.nextLine());
  12.  
  13. double priceOfRakia = 25;
  14. double priceOfWineInLitres = priceOfRakia - (0.4 * priceOfRakia);
  15. double priceOfBeerInLitres = priceOfRakia - (0.8 * priceOfRakia);
  16. double sumOfRakia = rakia * priceOfRakia;
  17. double sumOfWine = wine * priceOfWineInLitres;
  18. double sumOfBeer = priceOfBeerInLitres * beer;
  19. double sumOfWhisky = whiskyinLitres * whisky;
  20. double sumOfAll = sumOfRakia + sumOfWine + sumOfBeer + sumOfWhisky;
  21.  
  22. System.out.printf("%.2f", sumOfAll);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement