Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Find all the errors to make this program work in C++ Write the code to simulate

ID: 3528544 • Letter: F

Question

Find all the errors to make this program work in C++ Write the code to simulate a person putting money into a vending // machine for deep-fried twinkies. // *********************************************************************** // File Name: twinkie.cpp // Author: // Email Address: // Project Number: 4.15 // Description: Simulation of a vending machine that sells nature's // perfect food, deep-fried twinkies, for $3.50 each #include // We will use cents for all monetary values. This will let us // work with integer, rather than floating-point, variables. const int TWINKIE_PRICE = 350; // Prompt the user to insert coins until enough has been paid to buy // a twinkie. The total amount inserted, in cents, is returned. int accepts_money(); // Returns the amount of change that should be returned to the user. int compute_change(int total_paid); int main() { using namespace std; // Declare variables for the amount of money that the user enters, // along with the change that is to be returned to them. int money_entered, change; // Make sure that monetary values we output are formatted with // two digits after the decimal point. cout.setf(ios::fixed); cout.setf(ios::showpoints); cout.precision(2); // Collect money from the user monies_entered = accept_money(); // Figure out how much change to return change = compute_change(money_entered); // Dispense the twinkie cout << " Enjoy your deep-fried twinkie. Your change is $" << change/100.0 << endl; return 0; } // Prompt for coins until at least TWINKIE_PRICE has been // entered int accept_money() { using namespace std; int inserted = 0; char coins; do { cout << " Please insert coins: n - Nickel d - Dime " << " q - Quarter D - Dollar "; cout << "A fried twinkie costs $" << (TWINKIE_PRICE/100.0) << ". You have inserted $" << (inserted/100.0) << ". Next coin: "; cin >> coin; switch (coin) { case 'n': inserted += 5; break; case 'd': inserted += 10; break; case 'q': inserted += 25; break; case 'D': inserted += 100; break; default: cout << " '" << coin << "' is not recognized as a coin. "; } } while (inserted_once < TWINKIE_PRICES); return inserted; } int compute_change(int total_paid_out) { return (total_paid - TWINKIE_PRICE); }

Explanation / Answer

idk

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote