AddaprompttotheCondoSalesapplicationtoasktheusertospecifya1g
AddaprompttotheCondoSalesapplicationtoasktheusertospecifya(1)garage or a (2) parking space, but only if the condo 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.
Solution
import java.util.Scanner;
public class CondoSales
{
public static void main(String[] args)
{
int num, parking;
Scanner keyboard = new Scanner(System.in);
System.out.print(\"Press 1 for Park View, Press 2 for Golf Course View, or Press 3 for Lake View. \");
num = keyboard.nextInt();
if(num == 1)
{
System.out.println(\"Park View $150,000\");
}
else
if(num == 2)
{
System.out.println(\"Golf Course View $170,000\");
}
else
if(num == 3)
{
System.out.println(\"Lake View $210,000\");
}
else
{
System.out.println(\"Invalid Selection\");
}
System.out.print(\"Enter 1 for Garage or 2 for a Parking Space \");
parking = keyboard.nextInt();
if (parking == 1)
{
System.out.println(\"Garage $5000\");
}
else
if (parking == 2)
{
System.out.println(\"Parking Space\");
}
else
{
System.out.println(\"Invalid parking selection\");
}
}
}
