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

  List three debugging methods within the debugger which can

list three debugging techniques within the debugger that can be used to locate logical error in the java code. for each

  What would be the coding for this process

If I have a panorama, and want to stitch the 3 photos together perfectly (just lining them up along the edges to create one long photo, no matching needed), what would be the coding for this process?

  Value of x after the following code is executed

What will be the value of x after the following code is executed?int x = 20, y = 30;while (y

  A list of toppings should be shown on the screen as a menu

Write a menu-driven C++ program that allows a user to select from the following items: Pizza, Cheeseburger, and Hot Dog. Pizza should be represented by the integer value 1. Cheeseburger should be represented by the integer value 2.

  Stores a series of numbers in a binary tree.

Queue Converter, Write a program that stores a series of numbers in a binary tree. Then have the program insert the values into a queue in ascending order. Dequeue the values and display them on the screen to confirm that they were stored in the prop..

  Our string class always deletes the old character buffer

Our String class always deletes the old character buffer and reallocates a new character buffer on assignment or in the copy constructor.

  Design and code a new function that accepts as parameters

design and code a new function that accepts as parameters the gross pay by value and the federal tax state tax local

  Writer a program that allows the user to enter

Writer a program that allows the user to enter an unknown number of characters, stores those characters in a data structure (a vector) and then prints the values to the screen.

  Create a flowchart to show the processing

Flowchart and sample code in C#-Create a flowchart to show the processing that will take place for the implementation of a hash structure

  Write a program for find greatest common divisor

Write code for a recursive implementation of Euclid's algorithm

  Prepare program to check the syntax of the english language

Determine the form of the output dependent on the coefficients being input. Print and evaluate with peers in class."

  Write a program that calculatesand displays the distance

Distance per Tank of GasA car with a 20-gallon gas tank averages 21.5 miles per gallon when driven in townand 26.8 miles per gallon when driven on the highway.

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