Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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: GroceryItemOrder.java
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 modified(as an integer 1,2,5,6, etc..) and this
method doesnt return anything to the user.
toString displays the item value ex: 2 of chicken or 3 of eggs.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

=+b. The simple linear regression model states that y 5 a 1bx.

Answered: 1 week ago

Question

Conduct a needs assessment. page 283

Answered: 1 week ago