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

Previous Q& A

  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 ..

  Total cost and the total revenue

Consider the total cost and the total revenue given in the table below:

  Write research paper on students of fiu and facultys opinion

Write 750 word research proposal on students of FIU and facultys opinion on whether the US should intervene in war on terror.. especially since everything that has happened with ISIS.

  Signal is sample

1A baseband signal with 4 kHz bandwidth is sampled at 1.2 times of its Nyquist sampling rate. Calculate:A. The sampling rate at which this signal is sample.B. The guard frequency band between the repeats of the spectrum.

  International standards organization

As the CIO of a company engaged in business today, one of the main areas of focus is data protection. Discuss the key data protection points that must be taken into consideration prior to a strategy plan and policy being established for a company

  Which one will give more output

Which one will give more Output? Transformer on 50 Hz or on 60 Hz (When operates on 50 or 60 Hz frequency) ??

  Forensic investigator

The interpretation be misconstrued or incorrectly interpreted by a forensic investigator?

Reviews

Write a Review

 

Similar Q& A

  Create a code with two functions

You have to create a code with two functions. The first function takes a string as an argument and returns a Boolean that indicates whether or not the number of parentheses is balanced (utilizing a stack).

  Implement a second-order low-pass filter

Implement a second-order low-pass filter using the finite difference method. The finite difference method is a useful mathematical method that is used to numerically solve differential equations.

  Reverses the characters in a character array

Write the function reverseit that reverses the characters in a character array. You must also write main that calls reverseit.

  Write a program code to compute and build a table of reynold

Write a program code to compute and build a table of Reynolds numbers at flow velocities varying from 100 to 1000 ft/sec (at increments of 100)

  Questions of mcqs in c programming

The quality of a language that allows a programmer to express a computation clearly, correctly, concisely, and quickly is called _____.

  Program to check a social security number is valid or not

Write a program that prompts the user to enter a social security number in the format DDD-DD-DDDD, where D is a digit. The program displays "Valid SSN" for a correct social security number and "Invalid SSN" otherwise.

  Write pseudocode for a program

Write pseudocode for a program that prompts the user for a month and day and prints out whether it is one of the following four holidays.

  Counts all occurrences of a given string from such a bag

Write a C++ function that removes and counts all occurrences of a given string from such a bag.

  Design a program read the following information from the

design a program read the following information from the keyboard in which base class consist of employee name code and

  Your main function will still prompt the user

Your main function will still prompt the user for the account number and service code. Based on the service code, main will ask for the correct number of minutes, then call your functions above as needed to finish the job. In addition you must.

  Write program to input series of hourly temperatures

Create and write a c++ program which inputs series of 24 hourly temperatures from file, and outputs bar chart (using stars) of temperatures for the day.

  Design class for textbook-data field for grade level of book

Design a class named TextBook that is child class of Book. Include new data field for grade level of book. Create a displayTextBookInfo () method so that you can accommodate new grade-level field.

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