Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class WeddingInvestment {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String years = sc.nextLine();
- String type = sc.nextLine();
- String dessert = sc.nextLine();
- int months = Integer.parseInt(sc.nextLine());
- double total = 0;
- double totalSumForMonths = 0;
- switch (years) {
- case "one":
- if (type.equals("Small") && dessert.equals("yes")) {
- total = 9.98 + 5.5;
- totalSumForMonths = total * months;
- } else if (type.equals("Small") && dessert.equals("no")) {
- total = 9.98;
- totalSumForMonths = total * months;
- }
- if (type.equals("Middle") && dessert.equals("yes")) {
- total = 18.99 + 4.35;
- totalSumForMonths = total * months;
- } else if (type.equals("Middle") && dessert.equals("no")) {
- total = 18.99;
- totalSumForMonths = total * months;
- }
- if (type.equals("Large") && dessert.equals("yes")) {
- total = 25.98 + 4.35;
- totalSumForMonths = total * months;
- } else if (type.equals("Large") && dessert.equals("no")) {
- total = 25.98;
- totalSumForMonths = total * months;
- }
- if (type.equals("ExtraLarge") && dessert.equals("yes")) {
- total = 35.99 + 3.85;
- totalSumForMonths = total * months;
- } else if (type.equals("ExtraLarge") && dessert.equals("no")) {
- total = 35.99;
- totalSumForMonths = total * months;
- }
- break;
- case "two":
- if (type.equals("Small") && dessert.equals("yes")) {
- total = (8.58 + 5.5);
- totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
- } else if (type.equals("Small") && dessert.equals("no")) {
- total = 8.58;
- totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
- }
- if (type.equals("Middle") && dessert.equals("yes")) {
- total = 17.09 + 4.35;
- totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
- } else if (type.equals("Middle") && dessert.equals("no")) {
- total = 17.09;
- totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
- }
- if (type.equals("Large") && dessert.equals("yes")) {
- total = 23.59 + 4.35;
- totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
- } else if (type.equals("Large") && dessert.equals("no")) {
- total = 23.59;
- totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
- }
- if (type.equals("ExtraLarge") && dessert.equals("yes")) {
- total = 31.79 + 3.85;
- totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
- } else if (type.equals("ExtraLarge") && dessert.equals("no")) {
- total = 31.79;
- totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
- }
- break;
- }
- System.out.printf("%.2f lv.", totalSumForMonths);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement