Advertisement
Guest User

Untitled

a guest
May 20th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. package Demos;
  2.  
  3. import java.time.LocalDate;
  4. import java.time.format.DateTimeFormatter;
  5. import java.util.Scanner;
  6.  
  7. public class DemoClass {
  8.     public static void main(String[] args) {
  9.         Scanner scan = new Scanner(System.in);
  10.  
  11.         double wiskeyPrice = Double.parseDouble(scan.nextLine());
  12.         double beerAmount = Double.parseDouble(scan.nextLine());
  13.         double wineAmount = Double.parseDouble(scan.nextLine());
  14.         double rakiaAmount = Double.parseDouble(scan.nextLine());
  15.         double wiskeyAmount = Double.parseDouble(scan.nextLine());
  16.  
  17.         double rakiaPrice = wiskeyPrice / 2;
  18.         double winePrice = rakiaPrice - (rakiaPrice * 0.4);
  19.         double beerPrice = rakiaPrice - (rakiaPrice * 0.8);
  20.  
  21.         double wiskeyTotal = wiskeyAmount * wiskeyPrice;
  22.         double rakiaTotal = rakiaAmount * rakiaPrice;
  23.         double wineTotal = wineAmount * winePrice;
  24.         double beerTotal = beerAmount * beerPrice;
  25.  
  26.         double total = wiskeyTotal + rakiaTotal + wineTotal + beerTotal;
  27.         System.out.printf("%.2f", total);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement