Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Alcohol {
- public static void main(String[] agrs) {
- Scanner scan = new Scanner(System.in);
- double whiskeyBGN = Double.parseDouble(scan.nextLine());
- double beerLiters = Double.parseDouble(scan.nextLine());
- double wineLiters = Double.parseDouble(scan.nextLine());
- double rakiaLiters = Double.parseDouble(scan.nextLine());
- double whiskeyLiters = Double.parseDouble(scan.nextLine());
- double priceRakia = whiskeyBGN / 2;
- double priceWine = priceRakia - (0.4 * priceRakia);
- double priceBeer = priceRakia - (0.8 * priceRakia);
- double sumRakia = priceRakia * rakiaLiters;
- double sumBeer = priceBeer * beerLiters;
- double sumWine = priceWine * wineLiters;
- double sumWhiskey = whiskeyBGN * whiskeyLiters;
- double sum = sumBeer + sumRakia + sumWine + sumWhiskey;
- System.out.printf("%.2f", sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement