Create an array of five shippedorder objects

Assignment Help Basic Computer Science
Reference no: EM13322322

1. Create a class named Order that performs order processing of a single item that sells for $19.99 each.

o Create 4 Order class fields: order number, customer name, quantity ordered, and total price. Create public accessors for each field except total price.

o Create an Order class constructor that takes parameters for all of the class fields except total price.

o The total price field is calculated as quantity ordered times unit price (19.95) whenever the quantity is set, so it only needs a get accessor (read only). total = quantity * PRICEEACH

o Create an (override) Equals() method that determines two Orders are equal if they have the same order number.

o Create an (override) GetHashCode() method that returns the order number.

o Create an (override) ToString() method that returns a string containing all order information.

 

2. Create a ShippedOrder class that derives from Order.

o A ShippedOrder has a $4.00 shipping fee regardless of how many times it is ordered so each total order must add $4.00 to the total. total = quantity * PRICEEACH + SHIPPING_FEE

o Override any any methods in the parent class as necessary.

 

3. In Main:

o Create an array of five ShippedOrder objects.

o Prompt the user for values for each Orders object; do NOT allow duplicate order numbers and force the user to reenter the order when a duplicate order number is entered.

o ShippedOrder objects should be sorted by order number before they are displayed.

o When the five valid orders have been entered, display them all plus a total of all orders.

 

4. Internal Documentation.

Note that you will be overriding three object methods in the Order class and at least one of those in the ShippedOrder class. In the ShippedOrder class you will also need to override the Quantity accessor/property. Don't forget about IComparable.

An example of program output might look like this:

Enter order number 500
Enter customer name Johnson
Enter quantity 2
Enter order number 200
Enter customer name Olson
Enter quantity 1
Enter order number 200
Sorry, the order number 200 is a duplicate.
Please reenter 100
Enter customer name Jensen
Enter quantity 8
Enter order number 300
Enter customer name Swensen
Enter quantity 2
Enter order number 400
Enter customer name Olafsun
Enter quantity 4

Summary:

ShippedOrder 100 Jensen 8 @$19.95 each. Shipping is $4.00
Total is $163.60
ShippedOrder 200 Olson 1 @$19.95 each. Shipping is $4.00
Total is $23.95
ShippedOrder 300 Swensen 2 @$19.95 each. Shipping is $4.00
Total is $43.90
ShippedOrder 400 Olafsun 4 @$19.95 each. Shipping is $4.00
Total is $83.80
ShippedOrder 500 Johnson 2 @$19.95 each. Shipping is $4.00
Total is $43.90

Total for all orders is $359.15
Press any key to continue . . .


Declaring a child class:

public class Fiction : Book //for extending classes, you must use a single colon between the derived class name and its base class name
{
private:
//put your private data members here!
public:
//put your public methods here!
}

NOTE: when you instantiate an object of Fiction child class, you will inherit all the data members and methods of the Book class.

Reference no: EM13322322

Questions Cloud

Calculate the radius of curvature of the mirror : A 4.2cm tall object is placed 27cm in front of a spherical mirror. It is desired to produce a virtual image that is upright and 3.0cm tall. What is the radius of curvature of the mirror
What types of unethical behaviors : What types of unethical behaviors should we expect to see from our Clients? Also, how do we interpret "honest" mistakes from intentional fraud?
How long did the electric heating system run that night : A passive solar house that is losing heat is outdoors at an average rate of 50,000 kJ/h is maintained at 22oC at all times during a winter night for 10h.
What can you say about the index of refraction of the liquid : A beam of light is emitted 8.2cm beneath the surface of a liquid and strikes the surface 7.2cm from the point directly above the source. what can you say about the index of refraction of the liquid
Create an array of five shippedorder objects : Create 4 Order class fields: order number, customer name, quantity ordered, and total price. Create public accessors for each field except total price.
State a reaction mechanism for the dehydration : Write a reaction mechanism for the dehydration of 4,5-dimethyl-3-hexanol in concentrated phosphoric acid. Use curved arrows to show electron movement and clearly show the major product formed.
Determine cir and fdr with foamed asphalt : The pavement structure consists of 160 mm of hot-mix asphalt (HMA), 150 mm of granular base and 450 mm of subbase placed over silty clay subgrade. The pavement is 20 years old and its current PCI is 50.
Find the direction of the electron force on this charge : A charge q=-1.0 nC is instantaneously at a place where the electric field is 45 kN/C due east. hat are the magnitude and direction of the electron force on this charge
The statement of cash flow under the indirect method : The below is a list of activities to be included in the preparation of UMUC's 2013 statement of cash flows. Prepare, IN GOOD FORM, the statement of cash flow under the indirect method.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  To perform queries

To perform queries on a relational database system using SQL? To demonstrate an advanced knowledge of stored procedures, stored functions and triggers.

  Find an article that describes a computerized database

Find an article that describes a computerized database system that is in use in the field in which you work

  Probability and statistics for computer science

Probability and Statistics for Computer Science  - What is the probability that V will get the project and if V gets the project, what is the probability that W did not bid

  What window events can a program handle

What window events can a program handle? Explain the difference between the WindowListener interface and the WindowAdapter.

  Determine the optimal plan

DSS Inc. is an electronics company with production facilities located in Atlanta, Boston, and Chicago. Components produced at these facilities may be shipped to the firm's regional warehouses that are located in Edison and Fargo.

  Current design model of it

In the current design model of IT service provision at NSI, the service desk function is provided in-house by TAFE employees. Consider the option of outsourcing the service desk.

  Encourage cooperation consistent with standards

Encourage cooperation from all, make it suitable to clean up, be consistent with standards - Who will put it away? Explain where will it be put away? When will it be put away?

  Explaining framework software architecture

Terms architectural style, architectural pattern, and framework are frequently encountered in discussions of software architecture.

  Describing data-s confidentiality and integrity

They are asking candidates to describe briefly how they would satisfy StoreItRite's requirements as stated above. How would a successful candidate respond?

  What other errors are there if any cin value

void getValue(int value&) { cout > value& } I already know "cint" should be "cin". What other errors are there, if any? Should the cin value "value&" have the ampersand attached, or not?

  Write a menu driven program

At least the menu, finding the smallest number and calculating the sum are to be functions. Provide an error message if an invalid choice is entered.

  Write a program to perform grocery check-out procedure

Write a program to perform grocery check-out procedure for a simple store. Use a dynamic array of structures (Up to 100) to store this information. For each product we store the following information.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd