Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class AlcoholMarket {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double whisky = Double.parseDouble(scanner.nextLine());
- double beer = Double.parseDouble(scanner.nextLine());
- double wine = Double.parseDouble(scanner.nextLine());
- double rakia = Double.parseDouble(scanner.nextLine());
- double whiskyinLitres = Double.parseDouble(scanner.nextLine());
- double priceOfRakia = 25;
- double priceOfWineInLitres = priceOfRakia - (0.4 * priceOfRakia);
- double priceOfBeerInLitres = priceOfRakia - (0.8 * priceOfRakia);
- double sumOfRakia = rakia * priceOfRakia;
- double sumOfWine = wine * priceOfWineInLitres;
- double sumOfBeer = priceOfBeerInLitres * beer;
- double sumOfWhisky = whiskyinLitres * whisky;
- double sumOfAll = sumOfRakia + sumOfWine + sumOfBeer + sumOfWhisky;
- System.out.printf("%.2f", sumOfAll);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement