Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task - 2 : [ 5 0 pts . ] Write a java program to implement the following OrderingSystem class as shown in figure (

Task-2:
[50 pts.]
Write a java program to implement the following OrderingSystem class as shown in figure (a):
Figure (a)
Order
productName: String
quantity: int
set (productName, quantity): void
setProductName (productName): void
setQuantity (quantity): void
getProductName(): String
getQuantity(): int
readInput(): void
toString(): String
Figure (b)
This class has one private variable totalQuantityordered of type double and the array of objects of Order class. This class also have three methods. 1) computeTotalQuantity ()- this method computes the total quantity ordered for this order. 2) getData - this method first asks the user about how many products user want to order. Then, it creates the array of Order accordingly and calls the readInput () method of Order class to get data from user. 3) writeData ()- this method prints out the total quantity ordered and calls the tostring method of Order class to print the details of each product ordered.
The orderingsystem class uses the order class to store the information of product and quantity. Create the Order class separately as shown in figure (b):
The Order class has two private variables, productName and quantity. This class has reasonably defined constructors (no-arguments and arguments), the no-argument constructor must call the constructor that accepts arguments (with reasonable arguments) and the arguments constructor calls the set () method that sets the values for productName and quantity. This
COP2210-Assignment 7
Page 2 of 3
image text in transcribed

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

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions