Question: JAVA PROGRAMMING Instructions 1) Create a class named after your favorite object in the whole world. For example, if you love pizza, then create a
JAVA PROGRAMMING
Instructions
1) Create a class named after your favorite object in the whole world. For example, if you love pizza, then create a class called Pizza.java. This class should not have a main method
2) Create Instance Variables (attributes)
* Create at least 3 private instance variables (attributes) for your class
* You must use at least 3 different data types for your instance variables
3) Create getter (accessor) and setter (mutator) methods
* Create a getter (accessor) method for each of your instance variables
* Create a setter (mutator) method for each of your instance variables
4) Create a Method to display your data
* Create a method called display, that simply prints out the values of all instance variables of your object
* The method should have no parameters and no return type
5) Create another method that simply increments any one of your instance variables by 1
* The method should have no parameters and no return type
6) Create 2 Constructors
* 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
7) Testing your program
* Create a class called Demo.java. This class will contain your main method
* Create an instance of your class by using the default constructor.
- Call all your objects set methods to assign values to your object
- Call the objects display method, to print out it's values
* Create another instance of your class by using the parameterized constructor
- Call the objects display method, to print out it's values
* Call the method you created that increments one instance variable, and then call the display method again
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
