Question

In: Other

Complete the code provided to add the appropriate amount to totalDeposit. #include <iostream> using namespace std;...

Complete the code provided to add the appropriate amount to totalDeposit.

#include <iostream>

using namespace std;

int main() {

enum AcceptedCoins {ADD_QUARTER, ADD_DIME, ADD_NICKEL, ADD_UNKNOWN};

AcceptedCoins amountDeposited = ADD_UNKNOWN;

int totalDeposit = 0;

int usrInput = 0;

cout << "Add coin: 0 (add 25), 1 (add 10), 2 (add 5). ";

cin >> usrInput;

if (usrInput == ADD_QUARTER) {

totalDeposit = totalDeposit + 25;

}

/* Your solution goes here */

else {

cout << "Invalid coin selection." << endl;

}

cout << "totalDeposit: " << totalDeposit << endl;

return 0;

}

Note - I only need the part where it says -- your solution goes here. Thank you very much for the help. C++ program

Solutions

Expert Solution

else if(usrInput == ADD_DIME){

  totalDeposit = totalDeposit+10;

}

else if(usrInput == ADD_NICKLE){

  totalDeposit = totalDeposit+5;

}



Related Solutions

I want Algorithim of this c++ code #include<iostream> using namespace std; int main() { char repeat...
I want Algorithim of this c++ code #include<iostream> using namespace std; int main() { char repeat = 'y'; for (;repeat == 'y';){ char emplyeename[35]; float basic_Salary,EPF, Dearness_Allow, tax, Net_Salary , emplyee_id; cout << "Enter Basic Salary : "; cin >> basic_Salary; Dearness_Allow = 0.40 * basic_Salary; switch (01) {case 1: if (basic_Salary <= 2,20,00) EPF = 0; case 2: if (basic_Salary > 28000 && basic_Salary <= 60000) EPF = 0.08*basic_Salary; case 3: if (basic_Salary > 60000 && basic_Salary <= 200000)...
using only loops, no functions and no arrays. with the heading: #include <iostream> using namespace std;...
using only loops, no functions and no arrays. with the heading: #include <iostream> using namespace std; "Write a program that asks the user to enter an odd positive integer. The program reads a value (n) entered by the user and prints an n x n grid displaying a large letter X. The left half should be made up of pluses (+) and the right half should be made with the character "x" and the very center should be an asteric...
I need a Flowgorithm chart of this #include using namespace std; int main() {    float...
I need a Flowgorithm chart of this #include using namespace std; int main() {    float CISBook[] = {55.5,35.8,67.5};    float MATHBook[] = {25.5, 54.5};    float MECBook[] = {65.0,75.5,86.8};    float sumCIS=0, sumMATH = 0, sumMEC = 0;              for (int i=0; i<4; i++)    {sumCIS += CISBook[i];}       for (int i=0; i<3; i++)    {sumMATH += MATHBook[i];}       for (int i=0; i<4; i++)    {sumMEC += MECBook[i];}       cout<<"\nTotal for CIS Books:...
Take the following C++ program and translate it into assembly language( pep9 ) #include using namespace...
Take the following C++ program and translate it into assembly language( pep9 ) #include using namespace std; char ch; int main() {    cin >> ch;    cout << "You inputted " << ch << endl;    ch++;    cout << "Next character is " << ch << endl; if (ch <= ‘Z’)         cout << “Could be luppercase\n”;    return 0; }
Complete the following reaction. Add hydrogen atoms and charges to the appropriate atoms.
Complete the following reaction. Add hydrogen atoms and charges to the appropriate atoms.
Exercises Code of Conduct Exercises Instructions:  Answer the following in complete sentences using the AICPA's revised Code...
Exercises Code of Conduct Exercises Instructions:  Answer the following in complete sentences using the AICPA's revised Code of Conduct, providing the ET references for each of your responses. For questions with multiple parts, include multiple ET references as appropriate. What are the three broad categories of safeguards identified in Part 1 of the Code, in the Conceptual Framework for members in public practice? Which category of safeguard cannot be relied upon, by itself, to reduce threats to an acceptable level?
bus reservation system code using c language in this system we can add seat and remove....
bus reservation system code using c language in this system we can add seat and remove. this code will be in c language using 2 d aray
Complete the intake and output record on the next page for Mr Cohen using the information provided.
Complete the intake and output record on the next page for Mr Cohen using the information provided.8:30 am             Breakfast                                                                         Glass of orange juice                                                                                                                         Soup bowl of cream of wheat                                                                                  2 strips of bacon                                                    1 egg09:00 am             Voided 250cc urine10:00 am           Snack                                                      Large cup of eggnog10:30 am             Voided 150cc urine12:30 pm           Lunch                                                                    Bowl of cream of tomato soup2 slices of whole wheat toast with tuna fish                                                      1 cup of coffee                                                      1 cup of carrot sticks                                                      1 carton of milk                                                                     1 serving of vanilla ice-cream13:00 Voided 200 cc urine14:00 1...
Complete the following exercises using C programming language. Take screenshots of the code and its output...
Complete the following exercises using C programming language. Take screenshots of the code and its output where specified and paste them into in a well-labeled Word document for submission. Scenario Assume you are the CIO of an organization with three different IT department locations with separate costs. You want a program to perform simple IT expenditure calculations. Your IT expenditure target is $35,000 per site. Site expenditures: Site 1 – $35,000. Site 2 – $37,500. Site 3 – $42,500. Exercise...
Conduct an appropriate hypothesis test using the provided information [Neatly show all steps / necessary calculations,...
Conduct an appropriate hypothesis test using the provided information [Neatly show all steps / necessary calculations, including both a complete comparison & interpretation statement AND plain English inference statement]. The national average on a certification exam in the US last year was 68. For a sample of participants (n=64) who participated in a preparatory program before the exam, the mean was 76 with a sample standard deviation of 4. Using alpha = .05, is there a statistically significant difference between...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT