Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Test {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String DurationOfContract = scanner.nextLine();
- String TypeOfContract = scanner.nextLine();
- String AddedInternet = scanner.nextLine();
- int PayingMonths = Integer.parseInt(scanner.nextLine());
- double price = 0;
- if (DurationOfContract.equals("one")) {
- if (TypeOfContract.equals("Small")) {
- if (AddedInternet.equals("yes")) {
- price = (9.98 + 5.50) * PayingMonths;
- System.out.printf("%.2f lv.%n", price);
- } else if (AddedInternet.equals("no")) {
- price = 9.98 * PayingMonths;
- System.out.printf("%.2f lv.%n", price);
- }
- } else if (TypeOfContract.equals("Middle")) {
- if (AddedInternet.equals("yes")) {
- price = (18.99 + 4.35) * PayingMonths;
- System.out.printf("%.2f lv.%n", price);
- } else if (AddedInternet.equals("no")) {
- price = 18.99 * PayingMonths;
- System.out.printf("%.2f lv.%n", price);
- }
- } else if (TypeOfContract.equals("Large")) {
- if (AddedInternet.equals("yes")) {
- price = (25.98 + 4.35) * PayingMonths;
- System.out.printf("%.2f lv.%n", price);
- } else if (AddedInternet.equals("no")) {
- price = 25.98 * PayingMonths;
- System.out.printf("%.2f lv.%n", price);
- }
- } else if (TypeOfContract.equals("ExtraLarge")) {
- if (AddedInternet.equals("yes")) {
- price = (35.99 + 3.85) * PayingMonths;
- System.out.printf("%.2f lv.%n", price);
- } else if (AddedInternet.equals("no")) {
- price = 35.99 * PayingMonths;
- System.out.printf("%.2f lv.%n", price);
- }
- }
- }
- if (DurationOfContract.equals("two")) {
- if (TypeOfContract.equals("Small")) {
- if (AddedInternet.equals("yes")) {
- price = (8.58 + 5.50) * PayingMonths;
- price = price - price * 0.0375;
- System.out.printf("%.2f lv.%n", price);
- } else if (AddedInternet.equals("no")) {
- price = 8.58 * PayingMonths;
- price = price - price * 0.0375;
- System.out.printf("%.2f lv.%n", price);
- }
- } else if (TypeOfContract.equals("Middle")) {
- if (AddedInternet.equals("yes")) {
- price = (17.09 + 4.35) * PayingMonths;
- price = price - price * 0.0375;
- System.out.printf("%.2f lv.%n", price);
- } else if (AddedInternet.equals("no")) {
- price = 17.09 * PayingMonths;
- price = price - price * 0.0375;
- System.out.printf("%.2f lv.%n", price);
- }
- } else if (TypeOfContract.equals("Large")) {
- if (AddedInternet.equals("yes")) {
- price = (23.59 + 4.35) * PayingMonths;
- price = price - price * 0.0375;
- System.out.printf("%.2f lv.%n", price);
- } else if (AddedInternet.equals("no")) {
- price = 23.59 * PayingMonths;
- price = price - price * 0.0375;
- System.out.printf("%.2f lv.%n", price);
- }
- } else if (TypeOfContract.equals("ExtraLarge")) {
- if (AddedInternet.equals("yes")) {
- price = (31.79 + 3.85) * PayingMonths;
- price = price - price * 0.0375;
- System.out.printf("%.2f lv.%n", price);
- } else if (AddedInternet.equals("no")) {
- price = 31.79 * PayingMonths;
- price = price - price * 0.0375;
- System.out.printf("%.2f lv.%n", price);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement