[Solved]61 Create Class Want Java Examples May Include Coffee Toy Bike Car Person Cookie Etc Going Q37232792
6.1 Create any class that you want in Java. Some examples mayinclude: Coffee, Toy, Bike, Car, Person, Cookie, etc. We are goingto use this class to create objects.
1. Create a java class named after your object. (Note: Classesused to construct objects typically do not have a main method)
2. Create Instance variables (also called fields)
- Create at least 3 private instance variables for yourclass
- Use at least 3 different data types for your fields
3. Create getter (accessor) and setter (mutator) methods
- Create a getter method for each instance variable
- Create a setter method for each instance variable
4. Create a Method to display your data
- Create a method called display, that simply prints out thevalues of all instance variables of your object
- This method will have no parameters and not return a value
5. Create 2 Constructors
- Create a default constructor (no parameters) that assigns allyour instance variables to default values
- Create a parameterized constructor that takes all instancevariables as parameters, and sets the instance variables to thevalues provided by the parameters
6. Testing your program
- Create a class called Demo, which will contain your mainmethod
- Create an instance of your class (an object) by using thedefault constructor.
- Call all your objects setter (mutator) methods to assign valuesto your object
- Call the objects display method, to print out it’s values
- Create another instance of your class (another object) by usingthe parameterized constructor
- Call the objects display method, to print out it’s values
Expert Answer
Answer to 6.1 Create any class that you want in Java. Some examples may include: Coffee, Toy, Bike, Car, Person, Cookie, etc. We a… . . .
OR

