In: Computer Science
Submit a document with methods for an automobile class, and pseudo code indicating functionality of each method.
Example:
public String RemoveVehicle(String autoMake, String autoModel, String autoColor, int autoYear)
If
values entered match values stored in private variables
remove vehicle information
else
return message indicating mismatch
Class Automobile can have below methods with their pseudocodes :
SET methods to assign the values of the variables entered by the user to the variables:
public void setautoMake(String Make)
{
Assign the value of variable Make into the variable autoMake
(autoMake = Make)
}
public void setautoModel(String Model)
{
Assign the value of variable Model into the variable autoModel
(autoModel = Model)
}
public void setautoColor(String Color)
{
Assign the value of variable Color into the variable autoColor
(autoColor = Color)
}
public void setautoYear(int Year)
{
Assign the value of variable Year into the variable autoYear
(autoYear = Year)
}
Get methods to return the value of the variables set by the set methods above:
public String getautoMake ()
{
Return the value of the variable autoMake when the method getautoMake is
Called in the main method.
(return autoMake)
}
public String getautoModel ()
{
Return the value of the variable autoModel when the method getautoModel is
Called in the main method.
(return autoModel)
}
public String getautoColor ()
{
Return the value of the variable autoColor when the method getautoColor is
Called in the main method.
(return autoColor)
}
public int getautoYear ()
{
Return the value of the variable autoYear when the method getautoYear is
Called in the main method.
(return autoYear)
}
Speed method :
public void Speed (int speed)
{
Variable speed initialized to 0 in constructor of class Automobile
Increment the value of the variable speed by 5
(speed = speed + 5)
Display the current value of speed
}
Brakes method :
public void Brakes (int speed)
{
Variable speed initialized to 0 in constructor of class Automobile
Decrement the value of the variable speed by 5
(speed = speed - 5)
Display the current value of speed
}