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