Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class alcohol {
  4. public static void main(String[] args) {
  5. Scanner piqn = new Scanner(System.in);
  6. double priceWhiskey = Double.parseDouble(piqn.nextLine());
  7. double volumeBeer = Double.parseDouble(piqn.nextLine());
  8. double volumeWine = Double.parseDouble(piqn.nextLine());
  9. double volumeVodka = Double.parseDouble(piqn.nextLine());
  10. double volumeWhiskey = Double.parseDouble(piqn.nextLine());
  11. double priceVodka = priceWhiskey/2;
  12. double priceWine = priceVodka*0.6;
  13. double priceBeer = priceVodka*0.2;
  14. double totalPrice = volumeBeer*priceBeer + volumeVodka*priceVodka + volumeWhiskey*priceWhiskey + volumeWine*priceWine;
  15. System.out.printf("%.2f", totalPrice);
  16.  
  17.  
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement