Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class AlcoholExchange {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double priceWhiskey = Double.parseDouble(scanner.nextLine());
- double beerN = Double.parseDouble(scanner.nextLine());
- double wineN = Double.parseDouble(scanner.nextLine());
- double rakiaN = Double.parseDouble(scanner.nextLine());
- double whiskeyN = Double.parseDouble(scanner.nextLine());
- double priceBeer, priceRakia, priceWine, result;
- priceRakia = priceWhiskey/2;
- priceBeer = priceRakia - 0.8*priceRakia;
- priceWine = priceRakia - 0.4*priceRakia;
- result = priceWhiskey*whiskeyN + priceBeer*beerN + priceWine*wineN + priceRakia*rakiaN;
- System.out.printf("%.2f", result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement