Question: GroceryItemOrder Class: Name your class as: GroceryItemOrder . java You are to design a class GroceryItemOrder which represents an item to be included in the
GroceryItemOrder Class:
Name your class as: GroceryItemOrderjava
You are to design a class GroceryItemOrder which represents an item to be included in the
list.
Fields of course, all fields are private:
A string named name to store the name of the item in the list.
An integer named quantity to store the quantity of the item to be purchased.
A double named pricePerUnit to store the price of each item in the list.
Constructor:
Takes three parameters as the users input for the name of the item, quantity of the item
and price of each item.
The constructor initializes the name, quantity, pricePerUnit fields in the class using the
constructor arguments.
Methods be certain to declare the header of each method as listed here:
getCost doesnt take any arguments but returns the total cost of this item order.
setQuantity takes a new quantity to be modifiedas an integer etc.. and this
method doesnt return anything to the user.
toString displays the item value ex: of chicken or of eggs.
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
