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

  Show how your function works

Write a function named longestSortedSequence that accepts an array of integers as a parameter and that returns the length of the longest sorted non-decreasing sequence of integers in the array. For case given the sequence:

  Programming questions

Derive a class Programmer from Employee. Supply a constructor Programmer(string name, double salary) that calls the base-class constructor. Supply a function get_name that returns the name in the format "Hacker, Harry (Programmer)".

  Modify the payroll program

Modify the Payroll Program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked.

  Reads numbers from input and prints them in reverse order

Write a C program that reads ten numbers from input and prints them in reverse order. We assume that the data consists of integers. The program should conform to the following format:

  Write a header for the pow function

Write a header for the pow function that returns a double and takes two parameters a double named base and an integer named exp.

  Translate than c source code

Why does Ada take so much more time to translate than C source code? What phase of the Ada translation takes the longest?

  Function that has three inputs which are integers

Write a C++ function that has three inputs which are integers. The function returns true if the first number raised to the power of the second number equals the third number.

  Write a program to calculate existing angles and do if and

write a program to calculate existing angles and do if and then from this and to place fixed angles at certain position

  How to implement a state transition diagram

An Automated External Defibrillator (AED) is used in first aid ere someone has had a heart attack and needs to be kept alive until an ambulance arrives.

  Program that computes the monthly loan payment

Write a program that computes the monthly loan payment, given the loan amount (a double value), the interest, as a percent % (a double value), and the number of years to repay the loan

  A stack is referred to as a last-in first-out

This lab, along with your TA, will help you navigate through designing, implementing, and testing a dynamic stack. Recall, a stack data structure is a restricted linked list, where only the top node in the stack may be accessed at any given time

  The knight''s tour problem

The knight's tour problem is as follows: given an initial position for a single knight on an otherwise empty chessboard, find a sequence of 64 moves that will make the knight visit every square on the board exactly once

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