Class mail order

Assignment Help C/C++ Programming
Reference no: EM13760249

I. Write the class MailOrder to provide the following functions:

Set up one one-dimensional array for each field: product number (integer), unit price (double), and current inventory level (integer) in main memory to hold the above product information. There should be five rows (0 to 4) in each array, one for each item. For example, row 0 of the array for the product number is to hold the product number of product 1. Row 0 of the array for the unit price is to hold the unit price of product 1. Row 0 of the array for the current inventory level is to hold the current inventory level of product 1, etc.

The system should accept incoming sales orders until the user chooses to quit. In each sales order, a user can buy more than one item. For each item, the system accepts the product number and the quantity to be purchased. The system retrieves the correct unit price and current inventory level for that particular item. The system only sells up to the current inventory available. If the system can sell x pieces of this item in this order, the system calculates and displays the total amount for this item and also decreases the item inventory level by x immediately. When the user has finished keying in all the items of an order, the system displays the order total amount.

When the user says there are no more orders, the system displays the daily sales total. This is the total sales amount of all the orders processed. Then the system should end the execution of the system.

Detailed description of how the system should work is as follows:

When the system is run:

Display the following main question:

Please enter the next action ( a new order and ): <user enters 1 or 2>

If the user enters any value other than 1 and 2, then the system displays an error message and displays the above question until the user has entered either 1 or 2.

If the user chooses entering a new order (1), then display the next product number question:
Please enter the next product number to buy (1 - 5 or -99 = end): <user enters 1, 2, 3, 4, 5 or -99>

If the user enters a value that is not one of -99, 1, 2, 3, 4, and 5, then repeat this question again until the user has entered one of the acceptable values.

If user enters -99, this means the end of the current order:

Display order summary, for example:

Order Total Amount: $ 72.83

Add this order total amount to the daily sales total amount.

The system should go back to asking the main question, as shown above.

If the user enters 1, 2, 3, 4, or 5 (these are product numbers), this is the next item to be purchased:

If the current inventory level of this product is 0, display "This item is out of stock. Please pick another one." The system goes back to asking for the next product number, as shown above.

If the current inventory level is > 0, display "Unit Price: <the unit price of this item> " and "Current Quantity Available: <the current inventory level of this item>"
ask for the quantity ordered, "Enter quantity ordered: " <user enters the quantity ordered>.

If the quantity available is smaller than the quantity ordered, sell only the quantity available. Otherwise, sell the ordered quantity.

Display "Quantity Sold: <the quantity that can be sold>"
Calculate the amount for this item as Unit Price * Quantity Sold.
Display the amount for this item: "Item Amount: $ <the amount calculated>"
Add this amount to the current order total amount.

Since this item has been sold, update the current inventory level of this item.

Repeat the above until the user enters -99 for the next product number to buy.

Then the system displays the main question again and repeats the above until the user enters a 2.

If the user chooses ending the whole order entry operation (2), then the system displays the daily sales total amount and ends the execution.

II. Write the class MailOrderTesting to provide the following functions:

In method main of this application, instantiate an object of MailOrder and call the method processOrders of this MailOrder object to start order processing.

Reference no: EM13760249

Questions Cloud

What impact to various stakeholders of acquiring a robot : Who are the stakeholders in this scenario (both internal and external)? What is the impact to the various stakeholders of acquiring a surgical robot unit?
Stories of transformative leadership : How do the staff members perceive the work they do? How is this perception affecting their relationship with each other and how might it be harmful to clients? Provide examples.
Describe the key characteristics of a whistleblower : Describe the key characteristics of a whistleblower, and briefly summarize one (1) researched instance of whistleblowing in one (1) publicly traded company within the last 12 months. Include the details of the issue that the whistleblower reporte..
What exactly means the idea of "tropicalization" of american : What exactly means the idea of "tropicalization" of American poetry developed by Nuyorican poets such as Victor Hernandez Cruz?
Class mail order : Set up one one-dimensional array for each field: product number (integer), unit price (double), and current inventory level (integer) in main memory to hold the above product information. There should be five rows (0 to 4) in each array, one for e..
Coral dawn link the features of its services to the needs : Coral Dawn, a chain of luxury spas, specializes in Thai massages, Ayurveda remedies, and acupressure treatments. Its target customers are those who enjoy weekend spa treatments after a stressful week at work. When advertising, which of the following ..
The history of children literature in western culture : Need a timeline prepared to illustrates the history of children literature in western culture using at least five key milestone.
Four components of gdp : In 400-800 words, list the four components of GDP and provide an example of each, explaining how each item affects you and the way that you live today.
An opportunity to really challenge : Write a rave about something you despise. here's an opportunity to really challenge yourself. Think of something you have experienced recently that you absolutely loathed. You should choose something that other people would be able to experience for ..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Class to act as a generic array

Create a class to act as a generic array (i.e. the user will be able to choose the data type to be stored by passing the appropriate template argument.

  Computing value of the return statement

In the following code snippet, what is the value of the return statement for x = 4 and n = 4? int foo(int x, int n)

  Program on basic arithmetic operation

Two integers must be compared before the arithmetic operation and Subtract the two integers provided the first integer is greater than the second integer, otherwise add the two integers and subtract the second integer from the first integer.

  The two major modifications are the instruction of pointers

the two major modifications are the instruction of pointers and the calculation of mortgage interest rates.requirements

  Construct vector and linked lists data structures

You will prepare sorted versions of the Linked Lists and Vector data structures developed in class

  Find the sixth maclaurin polynomial for sin x

Find the sixth Maclaurin polynomial for sin x and use Chebyshev economization to obtain a lesser-degree polynomial approximation.

  Q1nbspnbspwrite c statements to do the following1 declare

q1nbspnbspwrite c statements to do the following1. declare an array alpha of 15 components of the type int.2. output

  What is the current size of q

Suppose an initially-empty queue Q has performed a total of 32 enqueue operations, 10 front operations, and 15 dequeue operations, 5 of which generated QueueEmptyExceptions, which were caught and ignored. What is the current size of Q?

  Implementation of sorting technique

Implementation of sorting technique

  Write c program that will input two values from the user

write c program that will input two values from the user with a prompt ? that are a value and a base with which you

  Modify it so it gives the ith largest number

the follow code gives the ith smallest number, how do you modify it so it gives the ith largest number ?

  Lab-1the goal of this lab is to better familiarize you with

lab-1the goal of this lab is to better familiarize you with polymorphism and the factory design pattern two key

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