Question: Create a super-class and a sub-class where an instance of the sub-class has the minimal attributes defined for the class below (at least 2 attributes
Create a super-class and a sub-class where an instance of the sub-class has the minimal attributes defined for the class below (at least 2 attributes one String and one numeric, at least 1 constructor with at least 1 parameter).
- The class you create must have at least 2 private attributes of which at least one is a String and one is a numeric (int or double)
- You need at least 1 constructor that will receive at least 2parameters (to uniquely identify a specific object)
- You need setters and getters for each of the fields where applicable
For the driver:
- prompt the user for the attributes (Scanner or JOptionPane)
- instantiate an instance of the class using the variables that have the user inputExample:myCheese = new Cheese(descriptionEntered,priceEntered,monthsAgedEntered);
- Display the attributes from the object using the getters .Example: System.out.println("Description: " + myCheese.getDescription());
- Although the driver requested does not call the setters/mutators, it does not mean you do not need to write the setters/mutators in the class.
JavaScript
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
