Question:
Can someone make this program for me please. Its very professional and important .?
Lucky
2013-07-26 07:03:30 UTC
For this project you will create a C program that implements a simple resistor inventory control system for an electronics lab. With this system the user will be able to add to inventory and remove from inventory any number of resistors of two different values. The system will keep track of the how many of each resistor have been added to, removed from and remains in stock. Below is a detailed description of the requirements of the project

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.
Five answers:
?
2013-07-26 09:14:31 UTC
This is the result of your questions: There is plenty of text you posted and everybody (you probably a little bit as well) knows that there is something terribly complicated going on. Some people's eyes even start reflecting "suns" and "dollars" for an assignment worth 5 minutes analyzing the text, 10 minutes writing the skeleton of the program and 5 more minutes to debug the code. There even is the speech of compressing weeks of work load into last minutes before assignment due. The following code lacks the ability to perform more than one transaction during program execution. I suggest that you can add the required loop to the code yourself, if you have a look into the functions provided. Please feel free to drop an e-mail, in case something seems wrong, or you require additional assistance.



One more addition: Please don't disregard the suggestion of husoski with reference to academic dishonesty. You please try to understand the code and you please become a good student.



Here the code:



#include



char Resistor_Size()

{

char cRet = 0;

while(cRet != 'a' && cRet != 'b') {

printf("\n(a) - 100 ohm resistor"

"\n(b) - 1000 ohm resistor> ");

if (scanf("%c", &cRet) != 1) {

printf("\nPlease enter >>>a<<< or >>>b<<<\n");

}

while(getchar() != '\n');

}

return cRet;

}



int Resistor_Number()

{

int iRet = 0;

char cAdd = 0;

int iQuantity = 0;

while(cAdd != '+' && cAdd != '-') {

printf("\n(+) Add resistors to stock"

"\n(-) Take resistors from stock> ");

if (scanf("%c", &cAdd) != 1) {

printf("\nPlease enter >>>+<<< or >>>-<<<\n");

}

while(getchar() != '\n');

}



do {

if (cAdd == '+') {

printf("\nHow many resistors do you want to add> ");

}

else {

printf("\nHow many resistors do you want to retrieve> ");

}

iRet = scanf("%d", &iQuantity);

if (iRet != 1) {

printf("\nNumbers only!");

}

else if (iQuantity < 0) {

printf("Negative numbers are not permitted!\n");

continue;

}

}while(iRet != 1);

return cAdd == '+' ? iQuantity : -iQuantity;

}



int main()

{

int iResistors[2] = {100, 100};

const char *resistors[] = {

" 100 ohm",

" 1000 ohm"

};

char a = Resistor_Size();

int idx = a == 'a' ? 0 : 1;

int iQuantity = 0;

printf("[%c] selected!\n", a);

iQuantity = Resistor_Number();

if (iResistors[idx] >= 0) {

iResistors[idx] += iQuantity;

printf("\nYou have %d %s Resistors in stock!", iResistors[idx], resistors[idx]);

}

else

printf("Please enter a number smaller or equal to %d", iResistors[idx]);

return 0;

}
husoski
2013-07-26 14:29:49 UTC
That's quite a project, and it does look important. One thing to keep in mind with pre-OOP languages like C is that you can still take an "object oriented" approach to the design of a program. Every entity that your program will deal with can be modeled with its own structure type. Write functions that manipulate those structures and they become your methods.



As for your question, there's more information about that here:

http://bit.ly/13aa1xo
alex
2013-07-26 15:17:03 UTC
I honestly don't know why people at the last minute post their assignments on here without doing any work what so ever and then expect someone to do weeks worth of work in a couple of days.

http://tinyurl.com/p43djpn
2013-07-26 15:13:38 UTC
If you have got a deep enough pocket, I will write you any program you want.
Strange By Design
2013-07-26 14:24:06 UTC
If I do the work, to whom should I send my invoice?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Loading...