Create any class that you want, to demonstrate that you know how to create classes and objects.
Create fields and getter/setter methods(1 point)
Create at least 3 private fields (attributes/instance variables) for your class
You must use at least 3 different data types for your fields
Create getter and setter methods (1 point)
Create a getter (accessor) method for each of your instance variables
Create a setter (mutator) method for each of your instance variables
Create 2 methods (1 point)
Create a method called display, that simply prints out the values of all instance variables of your object
Create another method that will do something related to your object that changes at least one of your fields value
Create 2 Constructors (1 point)
Create a default constructor (no parameters) that assigns all your instance variables to default values
Create a parameterized constructor that takes all instance variables as parameters, and sets the instance variables to the values provided by the parameters
Testing your program (1 point)
Create another class called Demo.java. This class will contain your main method
Create an 2 instances of your class (objects) by using the default constructor.
Call all your objects set methods to assign values to your object
Create 2 instances of your class (objects) by using the parameterized constructor
Displaying output (1 point)
Put all 4 objects into an array or ArrayList, and then loop through the array and call the display() method for each one.
This assignment has been answered 4 times in private sessions.
Or buy a ready solution below.
© 2023 Codify Tutor. All rights reserved