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 proce 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.
CondoSales.java
package condosales2;
import java.util.Scanner;
public class CondoSales {
public int choice,price;
public void dispaly(){
System.out.println("Summerdale Condo Sales Office");
System.out.println("Press 1 for Park View"+
"\nPress 2 for Golf Course View"+
"\nPress 3 for Lake View");
Scanner scanner=new Scanner(System.in);
choice=scanner.nextInt();
if(choice==1){
System.out.println("Park view Condos Price is $150,000");
price=150000;
}
else if(choice==2){
System.out.println("Golf Course view Condos Price is $170,000");
price=170000;
}
else if(choice==3){
System.out.println("Lake view Condos Price is are $210,000");
price=210000;
}
else{
System.out.println("You did not press proper Condos View choice.Press only 1,2 and 3");
price=0;
}
}
}
CondoSales2.java
package condosales2;
import java.util.Scanner;
public class CondoSales2 {
public static void main(String[] args) {
CondoSales object=new CondoSales();
object.dispaly();
if(object.choice==1||object.choice==2||object.choice==3){
System.out.println("Press 1 for Garage"+
"\nPress 2 for Parking Space");
Scanner scanner=new Scanner(System.in);
int choice1=scanner.nextInt();
if(choice1==1){
if(object.choice==1)
System.out.println("Park view Condos with Garage Price is: $"+((object.price)+5000));
if(object.choice==2)
System.out.println("Golf Course view Condos with Garage Price is: $"+((object.price)+5000));
if(object.choice==3)
System.out.println("Lake view Condos with Garage Price is: $"+((object.price)+5000));
}
else if (choice1 == 2) {
if(object.choice==1)
System.out.println("Park view Condos with Parking Price is: $"+((object.price)+5000));
if(object.choice==2)
System.out.println("Golf Course view Condos with Parking Price is: $"+((object.price)+5000));
if(object.choice==3)
System.out.println("Lake view Condos with Parking Price is: $"+((object.price)+5000));
}
else if(choice1 != 1 && choice1 != 2)
{
if(object.choice==1)
System.out.println("Park view Condos with no Garage Price is: $"+object.price);
if(object.choice==2)
System.out.println("Golf Course view Condos with no Garage Price is: $"+object.price);
if(object.choice==3)
System.out.println("Lake view Condos with no Garage Price is: $"+object.price);
}
}
else
System.out.println("You did not press proper Condos View choice.");
}
}
Comments
Leave a comment