Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String drink = scanner.nextLine(),
- sugar = scanner.nextLine();
- int drinkCount = Integer.parseInt(scanner.nextLine());
- double sum = drinkCount;
- if (drink.equals("Espresso")) {
- if (sugar.equals("Without")) {
- sum *= 0.90 * 0.65;
- } else if (sugar.equals("Normal")) {
- sum *= 1.00;
- } else if (sugar.equals("Extra")) {
- sum *= 1.20;
- }
- if (drinkCount > 5) {
- sum *= 0.75;
- }
- } else if (drink.equals("Cappuccino")) {
- if (sugar.equals("Without")) {
- sum *= 0.65;
- } else if (sugar.equals("Normal")) {
- sum *= 1.20;
- } else if (sugar.equals("Extra")) {
- sum *= 1.60;
- }
- } else if (drink.equals("Tea")) {
- if (sugar.equals("Without")) {
- sum *= 0.50 * 0.65;
- } else if (sugar.equals("Normal")) {
- sum *= 0.60;
- } else if (sugar.equals("Extra")) {
- sum *= 0.70;
- }
- }
- if (sum > 15) {
- sum *= 0.80;
- }
- System.out.printf("You bought %d cups of %s for %.2f lv.\n", drinkCount, drink, sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement