Question: Problem Design and implement these 4 files: A parent class called Purchase with item name, and price attributes ( this class will represent a purchase
Problem
Design and implement these files:
A parent class called Purchase with item name, and price
attributes this class will represent a purchase you made while
shopping at a grocery store for example Walmart or Superstore
Produce inherits from Purchase and adds a unit attribute is the
inherited price per kilogram? or for each item celery stalk etc
Cereal inherits from Purchase and adds a package size attribute
eg
A driver file to test the classes above
The Purchase, Produce and Cereal classes should have the usual
constructors default and parameterized an accessor method for
each attribute, a mutator method for each attribute, and a toString
method.
Child classes should call parent methods whenever possible to
minimize code duplication.
The driver program must test all the methods in each of the
classes. Include comments in your output to describe what you are
testing, for example System.out.printlntesting Purchase
toString"; Print out some blank lines in the output to make it
easier to read and understand what is beingoutput.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
