Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I did this but, it is not complete, I did not know to do the math part #include #include #include int main() { char Username[12];

image text in transcribedimage text in transcribedimage text in transcribed

I did this but, it is not complete, I did not know to do the math part

#include #include #include

int main() { char Username[12]; char password[13]; char option2; int option= 0, option3, option4,refillquant,dispensequant; int Amoxil = 40, Synthroid = 40, Zestril = 30, Vicodin = 10; system ("cls"); printf("Enter Username: "); scanf(" %s",Username); printf("Enter password: "); scanf(" %s",password); system("@cls|| clear"); while(strcmp(Username, "Admin21") !=0 && strcmp(password, "L3tM3in") !=0) { system("@cls||clear"); printf("Username: "); scanf(" %s", Username); printf("password: "); scanf(" %s", password); }

while (option != 4) { system("@cls||clear"); printf("\tDrug Admin System Menu \t1. Checkquantity \t2. Refill \t3. Dispense \t4. Quit Select option"); scanf(" %d",&option);

switch(option) { case(1): system("@cls||clear"); printf("\tCurrent quantity 1. Amoxil %d 2. Synthroid %d 3. Zestril %d 4. Vicodin %d Return to menu press b:", Amoxil,Synthroid,Zestril,Vicodin); scanf(" %c", &option2); break; case(2): system("@cls||clear"); printf("Select drug by number 1. Amoxil 2. Synthroid 3. Zestril 4. Vicidin "); scanf("%d", &option3); if(option3 == 1 || option3 == 2 || option3 == 3 || option3 ==4) {

printf("Enter refill quantity: "); scanf(" %d", &refillquant);

} break; case (3): system("@cls||clear"); printf("Select drug by # 1. Amoxil 2. Synthroid 3. Zestril 4. Vicidin "); scanf(" %d", &option4); if(option4 == 1 || option4 == 2 || option4 == 3 || option4 ==4) { printf("Enter dispense quantity: "); scanf(" %d", &dispensequant); } break; case (4): system("@cls||clear"); printf("Quit program"); break;

} }

return 0; }

The goal is to create a drug dispensing program that has 4 drugs and allows a user to check quantities, refill, and dispense. A user must first login with the following credentials before the menu becomes available Username: Admin19 Password: L3tM3in The 4 drugs and their initial quantities are Amoxil 40 Synthroid 40 Zestril 30 Vicodin 10 lf either username or password are incorrect, console will clear, and the program will stay at the log in| screen nter username:asdf nter Password: 3434 nter username: If credentials are correct and user presses enter, console will clear, and a menu will be displayed Enter username: Admine1 nter Password: L3tMBin Drug Admin. System enu: 1.Check Quantity 2.Refil1 3.Dispense 4.Quit elect Option: The code will run until option 4 is selected If option 1 is selected, the console is cleared, and the current quantity of each drug is displayed. A user presses b to go back to menu Current Quantities moxil 40 ynthroid 40 Zestril 30 icodin 10 Return to menu press b: If option 2 is selected, the console is cleared, and a prompt asks a user to select a drug and then enter a quantity to refill with. The program updates quantity and goes back to the main menu. Select drug by # 1.Amoxil 2.Synthroid 3.Zestril 4.Vicodin Enter refill quantity:1:1 User entered 2, which will refill Synthroid Need to select option 1 from main menu to see if results are updated Current Quantities moxil 40 ynthroid (51 estril 3 icodin 10 Return to menu press b From the menu, if option 3 is selected, the program will prompt the user to select a drug and how much to dispense select drug by # 1.Amoxil 2.Synthroid 3.Zestril 4.Vicodin nter quantity to dispense:7 User entered 4, which will dispense Vicodin When the user presses enter, the program goes back to the main menu. Option 1 must be selected to verify result of dispense. Current Quantities moxil 4e ynthroid 51 Zestril 30 icodin 3 eturn to menu press b: When dispensing, if the amount to dispense is greater than the current quantity, a prompt will appear stating there is not enough to dispense. A user can choose to dispense again, or return to main menu Select drug by # 1 . Anoxil 2.Synthroid 3,Zestril 4.vicodin Enter quantity to dispense:100 lot enough quantity to dispense. Press y to go back to dispense again. Press n to return to menu. If option 4 is selected from the main menu, the console clears and notifies user program stopped EABMEN 2980 Exam1.exe Quit Program Note: use following code to clear console system"@clsl Iclear"); Additional requirement: The code must include at least 2 functions. At least one of the 2 functions must use a pass by reference. Credit will be deducted for not following the additional requirement

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

4. Explain why strategic planning is important to all managers.

Answered: 1 week ago

Question

what is the differnece btween virtual reality and augmented reality

Answered: 1 week ago