Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class P01_AlcoholMarket {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double whiskeyPrice = Double.parseDouble(scanner.nextLine());
- double beerLiter = Double.parseDouble(scanner.nextLine());
- double wineLiter = Double.parseDouble(scanner.nextLine());
- double rakiaLiter = Double.parseDouble(scanner.nextLine());
- double whiskeyLiter = Double.parseDouble(scanner.nextLine());
- double rakiaPrice = whiskeyPrice/2;
- double winePrice = rakiaPrice-(rakiaPrice*((double) 40/100));
- double beerPrice = rakiaPrice-(rakiaPrice*((double) 80/100));
- double sumWhiskey = whiskeyPrice*whiskeyLiter;
- double sumBeer = beerPrice*beerLiter;
- double sumWine = winePrice*wineLiter;
- double sumRakia = rakiaPrice*rakiaLiter;
- double allSum = sumWhiskey+sumBeer+sumWine+sumRakia;
- System.out.printf("%.2f", allSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement