Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class AlcoholMarket {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6. double whiskeyPrice = Double.parseDouble(scan.nextLine());
  7. double beer = Double.parseDouble(scan.nextLine());
  8. double whine = Double.parseDouble(scan.nextLine());
  9. double rakiq = Double.parseDouble(scan.nextLine());
  10. double whiskey = Double.parseDouble(scan.nextLine());
  11. double rakiqPrice = whiskeyPrice - (whiskeyPrice * 0.5);
  12. double whinePrice = rakiqPrice - (rakiqPrice * 0.4);
  13. double beerPrice = rakiqPrice - (rakiqPrice * 0.8);
  14. double rakiqSum = rakiq * rakiqPrice;
  15. double beerSum = beer * beerPrice;
  16. double whineSum = whine * whinePrice;
  17. double whiskeySum = whiskey * whiskeyPrice;
  18. double finalPrice = rakiqSum + beerSum + whineSum + whiskeySum;
  19. System.out.printf("%.2f", finalPrice);
  20.  
  21.  
  22.  
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement