Menu

Find Least 20 Java Coding Standards Errors Three Java Programs Boatingjava Public Abstract Q43792432

Find at least 20 Java coding standards errors ineach 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, doubleaLength,
                  String aManufacturer, intaYear)
   {
      setStateRegistrationNo(aStateRegistrationNo);
       setLength(aLength);
      setManufacturer(aManufacturer);
       setYear(aYear);
   }

   // custom method
   public String factsAboutSelf()
   {
       // returns values of attributes asone string
       String boatDetails;
       boatDetails = ” “
       + stateRegistrationNo + ” “+
       length + ” “
       + manufacturer + ” “
       + year;
       return boatDetails;
   }
   // set accessor methods
   // for all variables
   public void setStateRegistrationNo(StringaStateRegistrationNo)
       {   stateRegistrationNo =aStateRegistrationNo; }
   public void setlength(double aLength)
       {   length = aLength;}
   public void setManufacturer(StringaManufacturer)
       {   manufacturer =aManufacturer; }
   public void setYear(int aYear)
       {   year = aYear; }
       get accessor methods
   public String getStateRegistrationNo()
       {   returnstateRegistrationNo; }
   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 fromBoat
   private String typeOfMaterial,OarType;    // declare as String

   // constructor
   public Rowboat(String aStateRegistrationNo, doubleaLength,
   String aManufacturer, int aYear,
                      StringaTypeOfMaterial, String anOarType )
   {
       // invoke super class constructorof Boat (4 arguments)
       super(aStateRegistrationNo,aLength, aManufacturer, aYear);

       // set subclass attributevalue
      setTypeOfMaterial(aTypeOfMaterial);
       setOarType(anOarType);
   }
   // tellAboutSelf method overides and invokessuperclass tellAboutSelf
   public String info_About_Self()
   {
       // invokes four superclass getmethods
       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(StringaTypeOfMaterial)
   {   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 usingtellAboutSelf 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());
   }
}

Expert Answer


Answer to Find at least 20 Java coding standards errors in each of the three Java programs. boating.java public abstract class boa…

OR