Question: In Java: a. Write a standard mode application for the Summerdale Condo Sales Office; the program determines the price of a condominium. Ask the user

In Java:

a. Write a standard mode application for the Summerdale Condo Sales Office; the program determines the price of a condominium. Ask the user to choose 1 for park view, 2 for golf course view, 3 for lake view. The output is the name of the chosen view as well as the price of the condo. Park view condos are $150,000, condos with golf course views are $170,000, and condos with lake views are $210,000. If the user enters an invalid code, set the price to 0. Save the file as CondoSales.java.

b. Add a prompt to the CondoSales application to ask the user to specify a (1) garage or a (2) parking space, but only if the view selection is valid. Add $5,000 to the price of any condo with a garage. If the parking value is invalid, display an appropriate message and assume that the price is for a condo with no garage. Save the file as CondoSales2.java.

>>>>The first part, part a has been completed successfully. I have the two following problems with part b and could use some help.

(1) When an invalid code is entered in the site selection, the program must display "invalid code" message before termination.

(2) When an invalid code is entered in the parking lot selection, the site selection is still valid, so after displaying "invalid" message, treat the parking selection as 2. park place, and display the site selected.

Part a:

package condosales;

//Part A

import java.util.Scanner;

public class CondoSales {

public static void main(String[] args) {

final int ParkViewPrice=150000;

final int GolfCourseViewPrice=170000;

final int LakeViewPrice=210000;

int choice;

int price;

Scanner scanner=new Scanner(System.in);

System.out.println("Please select view option: 1 - Park View 2 - Golf Course View 3 - Lake View");

choice=scanner.nextInt();

if(choice==1) {

price=ParkViewPrice;

System.out.println("Park View Condo Price is: $"+price);

}

else if(choice==2) {

price=GolfCourseViewPrice;

System.out.println("Golf Course View Condo Price is: $"+price);

}

else if(choice==3) {

price=LakeViewPrice;

System.out.println("Lake View Condo Price is: $"+price);

}

else {

price=0;

System.out.println("View selection invalid.");

}

}

}

Part B

package condosales;

//Part B

import java.util.Scanner;

public class CondoSales2 {

public static void main(String[] args) {

final int ParkViewPrice=150000;

final int GolfCourseViewPrice=170000;

final int LakeViewPrice=210000;

int GaragePrice=5000;

Scanner scanner=new Scanner(System.in);

int choice;

int price;

int parking;

System.out.println("Please select view option: 1 - Park View 2 - Golf Course View 3 - Lake View");

choice=scanner.nextInt();

if(choice==1) {

price=ParkViewPrice;

}

else if(choice==2) {

price=GolfCourseViewPrice;

}

else if (choice==3) {

price=LakeViewPrice;

}

else {

price=0;

}

if(price!=0 && (choice==1||choice==2||choice==3)) {

System.out.println("Please select parking option: 1 - Garage 2 - Parking Space");

parking=scanner.nextInt();

if(parking==1 && choice==1) {

System.out.println("Total cost of Park View Condo with Garage is: $"+(price+GaragePrice));

}

else if(parking==2 && choice==1) {

System.out.println("Total cost of Park View Condo with Parking Space is: $"+price);

}

else if(parking==1 && choice==2) {

System.out.println("Total cost of Golf Course View Condo with Garage is: $"+(price+GaragePrice));

}

else if(parking==2 && choice==2) {

System.out.println("Total cost of Golf Course View Condo with Parking Space is: $"+price);

}

else if(parking==1 && choice==3) {

System.out.println("Total cost of Lake View Condo with Garage is: $"+(price+GaragePrice));

}

else if(parking==2 && choice==3) {

System.out.println("Total cost of Lake View Condo with Parking Space is: $"+price);

}

else {

System.out.println("Parking selection invalid.");

}

}

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!