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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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