Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class E03weddingInvestment {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String timeOfContract = scanner.nextLine();
- String typeOfContract = scanner.nextLine();
- String ifdesert = scanner.nextLine();
- double months = Double.parseDouble(scanner.nextLine());
- double price = 0;
- double priceDesert = 0;
- double finalPriceDesert = 0;
- double total = 0;
- switch (typeOfContract)
- {
- case "Small":
- switch (timeOfContract)
- {
- case "one":
- price = 9.98;
- break;
- case "two":
- price = 8.58;
- break;
- default:
- break;
- }
- break;
- case "Middle":
- switch (timeOfContract)
- {
- case "one":
- price =18.99;
- break;
- case "two":
- price = 17.09;
- break;
- default:
- break;
- }
- break;
- case "Large":
- switch (timeOfContract)
- {
- case "one":
- price = 25.98 ;
- break;
- case "two":
- price = 23.59;
- break;
- default:
- break;
- }
- break;
- case "ExtraLarge":
- switch (timeOfContract)
- {
- case "one":
- price = 35.99;
- break;
- case "two":
- price = 31.79;
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- if (ifdesert.equalsIgnoreCase("yes"))
- {
- if (price <= 10)
- {
- priceDesert = 5.50;
- }
- else if (price <= 30)
- {
- priceDesert = 4.35;
- }
- else if (price > 30)
- {
- priceDesert = 3.85;
- }
- }
- if (timeOfContract.equalsIgnoreCase( "two"))
- {
- double totalPrice = price + priceDesert;
- double discount = totalPrice * 0.0375;
- total = (totalPrice - discount)* months;
- }
- else
- {
- total = (price + priceDesert)* months;
- }
- System.out.printf("%.2f lv.", total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment