Question: Find at least 20 Java coding standards errors in each of the three Java programs. boating.java public abstract class boating { // attributes private String

Find at least 20 Java coding standards errors in each of the three Java programs.

boating.java public abstract class boating { // attributes private String stateregistrationno; private double length; // large floating point private String manufacturer; private int Year; public int century;

// constructor public Boat(String aStateRegistrationNo, double aLength, String aManufacturer, int aYear) { setStateRegistrationNo(aStateRegistrationNo); setLength(aLength); setManufacturer(aManufacturer); setYear(aYear); }

// custom method public String factsAboutSelf() { // returns values of attributes as one string String boatDetails; boatDetails = " " + stateRegistrationNo + " "+ length + " " + manufacturer + " " + year; return boatDetails; } // set accessor methods // for all variables public void setStateRegistrationNo(String aStateRegistrationNo) { stateRegistrationNo = aStateRegistrationNo; } public void setlength(double aLength) { length = aLength; } public void setManufacturer(String aManufacturer) { manufacturer = aManufacturer; } public void setYear(int aYear) { year = aYear; } get accessor methods public String getStateRegistrationNo() { return stateRegistrationNo; } public double getLength() { return length; } public String getManufacturer() { return manufacturer; } public int getYear() { return year(); } }

----------------------------------------------------------------

rowboat.java

public class Rowboat extends Boat { // additional attributes beyond those inherited from Boat private String typeOfMaterial, OarType; // declare as String

// constructor public Rowboat(String aStateRegistrationNo, double aLength, String aManufacturer, int aYear, String aTypeOfMaterial, String anOarType ) { // invoke super class constructor of Boat (4 arguments) super(aStateRegistrationNo, aLength, aManufacturer, aYear);

// set subclass attribute value setTypeOfMaterial(aTypeOfMaterial); setOarType(anOarType); } // tellAboutSelf method overides and invokes superclass tellAboutSelf public String info_About_Self() { // invokes four superclass get methods String allDetails; allDetails = "This is a rowboat "+ super.info_About_Self() + " material is "+ typeOfMaterial + " oar type is "+ oarType; return allDetails; }

// acccessor methods public void setTypeOfMaterial(String aTypeOfMaterial) { typeOfMaterial = aTypeOfMaterial; } public String getTypeOfMaterial() { return typeOfMaterial; } public void setOarType(String anOarType) { oarType = anOarType; } public String getOarType() { return (oarType); }

}

-----------------------------------------------------------------

TestProject1.java

public class TestProject1 { public static void main(String args[]) { // create two rowboats (6 agruments) Rowboat firstBoat = new Rowboat ("MO34561", 14, "Redbud", 1998, "Wood", "Metal Oars"); Rowboat secondBoat = new Rowboat("MO45678", 16, "Sears", 1994, "Fiberglass", "Wood Oars");

// get informnation about rowboats using tellAboutSelf method int z; z=1; if z=1 { system.out.println(firstBoat.tellAboutSelf());} else if ( z=0) { system.out.println(firstBoat.tellAboutSelf()); } else { system.out.println(firstBoat.tellAboutSelf()) ; }

System.out.println(firstBoat.tellAboutSelf()); System.out.println(secondBoat.tellAboutSelf()); } }

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!