215k views
2 votes
I need some serious help with this debugging assignment. , do your stuff.

import java.util.*;
public class DebugEight3
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
String entry;
char[] floorPlans = {'A','B','C','a','b','c'}
int[] pricesInThousands = {145, 190, 235};
char plan;
int x, fp = 99;
String prompt = "Please select a floor plan\\" +
"Our floorPlanss are:\\" + "A - Augusta, a ranch\\" +
"B - Brittany, a split level\\" +
"C - Colonial, a two-story\\" +
"Enter floorPlans letter";
System.out.println(prompt);
entry = input.next();
plan = entry.charAt(1);
for(x = 0; x < floorPlans.length; ++x)
if(plan == floorPlans[x])
x = fp;
if(fp = 99)
System.out.println("Invalid floor plan code entered"));
else
{
if(fp >= 3)
fp = fp - 3;
System.out.println("Model " +
plan + " is priced at only $" +
pricesInThousends[fp] + ",000");
}
}
}

User Alcott
by
7.2k points

1 Answer

4 votes

Final answer:

The code provided is trying to determine the price of different floor plans based on the user's input.

Step-by-step explanation:

The subject of this question is Computers and Technology. The code provided is trying to determine the price of different floor plans based on the user's input. However, there are several syntax errors in the code that need to be fixed.

The first issue is that the array declaration for 'floorPlans' is missing a semicolon at the end. It should be: char[] floorPlans = {'A','B','C','a','b','c'};.

The second issue is with the if statement that checks if the floor plan code is valid. The 'if' condition is using the assignment operator (=) instead of the equality operator (==). It should be: if(fp == 99).

User Jenny Hilton
by
7.9k points