Question: Instructions The files provided in the code editor contain syntax and / or logic errors. In each case, determine and fix the problem, remove all

Instructions
The files provided in the code editor contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly.
An example of the program is shown below:
Do you want to add a 1- rowboat or 2- ocean liner >>2 Do you want to add a 1- rowboat or 2- ocean liner >>1 Do you want to add a 1- rowboat or 2- ocean liner >>2 This ocean linerboat carries 2400 and is powered by four engines This rowboat carries 2 and is powered by oars This ocean linerboat carries 2400 and is powered by four engines
Task 1: The DebugCustomer class compiles without error.
Task 2: The DebugRowboat class compiles without error.
Task 3: The DebugOceanLiner class compiles without error.
Task 4: The DebugNine3 class compiles without error.
Task 5: The DebugNine3 program accepts user input and displays the correct output.
// Declares an array that holds different boat types
import java.util.Scanner;
public class DebugNine3
{
public static void main(String[] args)
{
DebugBoat ref = new DebugBoat[3];
Scanner input = new Scanner(System.in);
int x;
int option;
DebugRowboat rowboat;
DebugOceanLiner liner;
for(x =0; x < ref.length; ++x)
{
System.out.println("Do you want to add a 1- rowboat or");
System.out.print("2- ocean liner >>");
option = input.nextInt();
if(option ==1)
{
rowboat = new FixDebugRowboat();
ref = rowboat;
}
else
{
liner = new FixDebugOceanLiner();
ref[x]= liner;
}
}
for(x =0; x <= ref.length; ++x)
{
ref[x].setPassengers();
ref[x].setPower();
System.out.println(ref[x].tooString());
}
}
}
public abstract class DebugBoat
{
String boatType = new String();
int passengers;
String power = new String();
public DebugBoat(String bt)
{
boatType = bt;
}
public boolean equals(DebugBoat otherBoat)
{
boolean result;
if((passengers == other.passengers) &&
(power.equalls(otherBoat.power)))
result = true;
else
result = false;
return result;
}
public String toString()
{
return("This "+ boatType +" boat carries "+ passengers +
" and is powered by "+ power);
}
public abstract void setPower;
public abstract void setPassengers;
}
public class DebugOceanLiner extends DebugBoat
{
public DebugOceanLiner()
{
super("ocean liner");
setPassengers();
setPower();
}
public void setPassengers()
{
passengers =2400;
}
public void setPower()
{
superpower = "four engines";
}
}
public class DebugRowboat extends DebugBoat
{
public FixDebugRowboat()
{
super("row");
setPassengers();
setPower();
}
public void setPassengers()
{
super.passngers =2;
}
public void setPower()
{
super.power = "oars";
}
}
Please help debug these 4 using java

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 Programming Questions!