Question

In: Computer Science

Submit a document with methods for an automobile class, and pseudo code indicating functionality of each...

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

Solutions

Expert Solution

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

      }


Related Solutions

GIVEN THE CODE BELOW Given the following class: /** * Document class. */ public class Document...
GIVEN THE CODE BELOW Given the following class: /** * Document class. */ public class Document { private int words; /** * constructor * pre: none * post: A Document object created. Words initialized to 0. */ public Document() { words = 0; //default words } /** * Changes the number of document words. * pre: none * post: Words has been changed. */ public void setWords(int numWords) { words = numWords; } /** * Calculates the number of pages....
You must write the correct code for all member methods so that queue functionality can be...
You must write the correct code for all member methods so that queue functionality can be obtained. Changes to the class definition, instance variables, and signatures of the membership method are not allowed. This class has no main method. package javaclass; /** * A queue structure of Movie objects. Only the Movie values contained * in the queue are visible through the standard queue methods. The Movie * values are stored in a DoubleLink object provided in class as attribute....
Convert this pseudo code program into sentences. import java.util.ArrayList; import java.util.Collections; class Bulgarian {    public...
Convert this pseudo code program into sentences. import java.util.ArrayList; import java.util.Collections; class Bulgarian {    public static void main(String[] args)    {        max_cards=45;        arr->new ArraryList        col=1;        card=0;        left=max_cards;        do{            col->random number            row->new ArrayList;            for i=0 to i<col            {                card++                add card into row            }   ...
Using Java, define a train class and write code to demonstrate its functionality The train should...
Using Java, define a train class and write code to demonstrate its functionality The train should run between Boston and New York, stopping at different, different station along the way. Provide output to indicate the train’s current status.
You must write an appropriate code for all member methods so that a double-linked list functionality...
You must write an appropriate code for all member methods so that a double-linked list functionality can be obtained. Changes to the class definition, instance variables, and signatures of the membership method are not allowed. This class has no main method. package javaclass; /** * The class for doubly-linked data structures. Provides attributes * and implementations for getLength, isEmpty, and toArray methods. * The head attribute is the first node in any doubly-linked list and * last is the last...
•Use commented pseudo-code to describe a process for each of the following: 1)Assigning a shopper to...
•Use commented pseudo-code to describe a process for each of the following: 1)Assigning a shopper to one of several checkout lines based on: •the number of shoppers already in each line, and •the number of items in the shopper’s cart, and •the type of items (e.g., “Food”, “Clothing”, “Housewares”, etc.) 2)Assigning a new student into the correct desk in a room of students seated in alphabetical order •Design classes (attributes and methods) for the following data structures: 4)Stack 5)Queue
Please submit a Netbeans project with a class called RecursionExercises.java implementing the following methods: public static...
Please submit a Netbeans project with a class called RecursionExercises.java implementing the following methods: public static int reverse(int number) This method returns the positive integer obtained when the digits of the parameter is reversed. For example, when called with the parameter 12345, this method would return 54321. (Do this with proper integer arithmetic instead of just simply converting to String, reversing that and then using parseInt to extract the result). Hint: The number of digits of a number can be...
Write pseudo code for the following parts of class BinarySearchTree: a) find(x) b) contains(x) c) add(x)...
Write pseudo code for the following parts of class BinarySearchTree: a) find(x) b) contains(x) c) add(x) d) remove(x) e) splice(x) f) min() g) max() h) pred() i) succ() j) floor() k) ceil()
I need this code in java. Task (1) Create two files to submit: ItemToPurchase.java - Class...
I need this code in java. Task (1) Create two files to submit: ItemToPurchase.java - Class definition ShoppingCartPrinter.java - Contains main() method Build the ItemToPurchase class with the following specifications: Private fields String itemName - Initialized in default constructor to "none" int itemPrice - Initialized in default constructor to 0 int itemQuantity - Initialized in default constructor to 0 Default constructor Public member methods (mutators & accessors) setName() & getName() (2 pts) setPrice() & getPrice() (2 pts) setQuantity() & getQuantity()...
Learning Objectives: To be able to code a class structure with appropriate attributes and methods. To...
Learning Objectives: To be able to code a class structure with appropriate attributes and methods. To demonstrate the concept of inheritance. To be able to create different objects and use both default and overloaded constructors. Practice using encapsulation (setters and getters) and the toString method. Create a set of classes for various types of video content (TvShows, Movies, MiniSeries). Write a super or parent class that contains common attributes and subclasses with unique attributes for each class. Make sure to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT