Lucky
2013-07-26 07:03:30 UTC
Project Marking - Marks will be assigned as follows: Menu, option selection, loop 20 Correct use of functions 20 Correct tracking of inventory and balance 30 Programmer’s block and comments 10 Inputs and displays 10 Ease of use, format and appearance to the user 10 Total 100
You buy resistors from a dealer to put into inventory and hand them out to technicians as
required. The program must keep track of two values of resistors - 100 ohm and 1000 ohm.
The program must allow you to add any number of each of those resistors to your inventory and
remove any number of those values from inventory. At all times you must be able to show:
1. Number of each resistor value in stock (inventory)
2. The number of each resistor value that has been taken out of stock. Initially you will start
with 100 resistors of each value in stock.
The Main Menu
When the program is run, the user is to be presented with the following Main Menu.
a) Add resistors to inventory
b) Take resistors from inventory
c) Resistors remaining in inventory x) Exit
Please select one of the choices above (a -> x):
The user must select one of the four choices presented (the program should support upper- case and
lower-case selections). If any other letter is pressed the program should report "Invalid
Selection", display the menu again, and prompt the user for their selection again. The action will
repeat until a valid selection is made.
a. Add resistors to inventory
When Option (a) is selected ask the user which resistor value he wants to order
a) 100 ohm b) 1000 ohm
Then ask how many of the items he selected he wants to order.
b. Take resistors from inventory
When Option (b) is selected ask the user which value resistor he wants to remove from inventory.
Show the following:
a) 100 ohm b) 1000 ohm
Which value would you like to remove from inventory? Then ask:
How many resistors do you want to remove?
If there are not enough resistors of that value print
Not enough xxx ohm resistors in stock.
Do not change the number remaining in inventory if the full request can not be met.
After the transaction is completed, print:
You now have xxx 100 ohm resistors left in stock
You now have yyy 1000 ohm resistors left in stock
d. Inventory Balance
When the user chooses Inventory Balance, print the following:
You now have xxx 100 ohm resistors in stock
You now have yyy 1000 ohm resistors in stock
where xxx and yyy are the actual number or resistors in stock.
x. Exit
when this option is selected exit the program.
Program Requirements
The project has certain requirements that must be incorporated into the program.
When the program is initially run, the account the balance must begin at 100 resistors of each
value.
Functions
The program must include and use the following two functions:
Function Name: Resistor_Size
Parameters: None
Returns: "a" for 100 ohm resistors and "b" for 1000 ohm resistors
Return Type: char
Purpose: This function displays the menu to select the resistor value 'a' or
'b'.
If the user chooses something other than "a" or "b", the program should report "Invalid Value", and
display the menu again, and prompt the user for their selection again.
Function Name: Resistor_Number
Parameters: None
Returns: The number of the resistors to be added or removed from inventory.
Return Type: int
Purpose: This function displays the menu to select the number of resistors to
be added to or removed from inventory.
Outside these requirements, you are free to create any other functions you feel may be useful.