Question

Use this code to create multiple functions.



#include<iostream>

#include<iomanip>

#include<fstream>



using namespace std;



int main()



{

cout << fixed << showpoint << setprecision(2);


ofstream outFile;

outFile.open("Feras's.txt");

outFile << "..Skinny Feras's Restaurant ..\n\n" << endl;





int choise=10, quantity;

float paid, SubTotal=0, Tax = .10, Total, RM, more;



while(choise!=0)

{

system("cls");

cout << "\t**Welcome To Skinny Alsaif Restaurant Lol**" << endl;

cout << "\nWhat would you like to have?" << endl;

cout << "1. Burger." << endl;

cout << "2. Pizza." << endl;

cout << "3. Rize With Chickens." << endl;

cout << "4. Spaghetti." << endl;

cout << "5. Steak." << endl;

cout << "6. Apple pie." << endl;

cout << "7. Tea." << endl;

cout << "8. Coffee." << endl;

cout << "9. Salad." << endl;

cout << "10.Meat." << endl;

cout << "Subtotal: $" << SubTotal << endl;

cout << "Please Enter 0 whenever you are ready :)" << endl;

cout << "choise: ";

cin >> choise;



if (choise!=0)

{

cout << "Enter quantity: ";

cin >> quantity;



}

if(choise== 1)

SubTotal = SubTotal + (2.40 * quantity);

else if (choise == 2)

SubTotal = SubTotal + (5.99 * quantity);

else if (choise == 3 ||choise == 4)

SubTotal = SubTotal + (4.90 * quantity);

else if (choise == 5 || choise== 6 )

SubTotal = SubTotal + (6.79 * quantity);

else if (choise == 7 || choise== 8 )

SubTotal = SubTotal + (3.99 * quantity);

else if (choise == 9 || choise== 10 )

SubTotal = SubTotal + (7.50 * quantity);

}



system("cls");



cout << "\n\n*5SubTotal $" << SubTotal << endl;

cout << "*Tax $" << SubTotal * Tax << endl;

Total = SubTotal + (SubTotal * Tax);

cout << "*Total $" << SubTotal + (SubTotal * Tax) << endl;

cout << "*Enter Payment Amount $";

cin >> paid;



while(paid < Total)

{





system("cls");



cout << "\n\n*You did not paid enough" << endl;

cout << "*Amount paid $" << paid << " Total $" << Total << endl;

cout << "*Enter Payment Amount $";

cin >> more;

paid = paid + more;

}

if(paid >= Total)

RM = paid - Total;

outFile << "SubTotal $" << SubTotal << endl;

outFile << "Tax $" << Tax << endl;

outFile << "Total $" << Total << endl;

outFile << "Change due $" << paid - Total << endl;

cout << "*Change Due $" << RM << endl;

cout << "\nHave a Nice Day " << endl;



outFile.close();

system("pause");

return 0;

}

Use your code from the menu system created back in March so that it uses multiple functions. You should create as many functions as possible for this assignment. In addition, I would like to see the usage of arrays in your program where appropriate. This is not required, but strongly encouraged.
0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Use this code to create multiple functions. #include<iostream> #include<iomanip> #include<fstream> using namespace std; int main() {...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Convert to use functions where possible #include<iostream> #include<string> using namespace std; int main() {    string...

    Convert to use functions where possible #include<iostream> #include<string> using namespace std; int main() {    string first, last, job;    double hours, wages, net, gross, tax, taxrate = .40;    double oPay, oHours;    int deductions;    // input section    cout << "Enter First Name: ";    cin >> first;    cout << "Enter Last Name: ";    cin >> last;    cin.ignore();    cout << "Enter Job Title: ";    getline(cin, job);    cout << "Enter Hours Worked:...

  • im not sure why my code isnt working? include <iostream> #include <iomanip> using namespace std; int...

    im not sure why my code isnt working? include <iostream> #include <iomanip> using namespace std; int main() { int amountOfCoffee; double Price; char salesTaxChargeability; double TotalAmount; const double SALESTAX = 0.035; // 3.5 % cout << "\nEnter the number of pounds of coffee ordered in Pounds :"; cin >> amountOfCoffee; cout << "\nEnter the price of coffee per Pound :"; cin >> Price; cout << "\nIs sales tax Chargeable (y or n): "; cin >> salesTaxChargeability; if ( (salesTaxChargeability ==...

  • fully comments for my program, thank you will thumb up #include <iostream> #include <fstream> #include <string>...

    fully comments for my program, thank you will thumb up #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; struct book { int ISBN; string Author; string Title; string publisher; int Quantity; double price; }; void choice1(book books[], int& size, int MAX_SIZE) { ifstream inFile; inFile.open("inventory.txt"); if (inFile.fail()) cout <<"file could not open"<<endl; string str;    while(inFile && size < MAX_SIZE) { getline(inFile, str); books[size].ISBN = atoi(str.c_str()); getline(inFile, books[size].Title);    getline(inFile, books[size].Author); getline(inFile, books[size].publisher);          getline(inFile,...

  • This is C++ code for parking fee management program #include <iostream> #include <iomanip> using namespace std;...

    This is C++ code for parking fee management program #include <iostream> #include <iomanip> using namespace std; void input(char& car, int& ihour,int& imin, int& ohour, int& omin); void time(char car, int ihour, int imin, int ohour, int omin, int& phour, int& pmin, int& round, double& total); void parkingCharge (char car, int round, double& total); void print(char car, int ihour, int imin, int ohour, int omin, int phour, int pmin, int round, double total); int main() { char car; int ihour; int...

  • #include <iostream> #include <string> using namespace std; int main() { int number; int sum = 0;...

    #include <iostream> #include <string> using namespace std; int main() { int number; int sum = 0; while(true) { cout << "Please enter a number between 1 and 11: "; cin >> number; if (number >= 1 && number <= 11) { cout << number << endl; sum = sum + number; //only add the sum when number is in range: 1-11, so add wthin this if case } else { cout << number << endl; cout << "Out of range;...

  • #include <iostream> #include <chrono> using namespace std; double improvedPow(double x, int y) { // To be...

    #include <iostream> #include <chrono> using namespace std; double improvedPow(double x, int y) { // To be implemented by you } int main() { cout << "To calculate x^y ..." << endl; double x; int y; cout << "Please enter x: "; cin >> x; cout << "Please enter y: "; cin >> y; if(x == 0) { if (y > 0) cout << 0 << endl; else cout << "x^y is not defined" <<endl; } else { cout << improvedPow(x,y)...

  • #include <iostream> #include <conio.h> #include<limits> using namespace std; int main(){ char oparand, ch = 'Y'; int...

    #include <iostream> #include <conio.h> #include<limits> using namespace std; int main(){ char oparand, ch = 'Y'; int num1, num2, result; while(ch == 'Y'){ cout << "Enter first number: "; cin >> num1; while(1){//for handling invalid inputs if(cin.fail()){ cin.clear();//reseting the buffer cin.ignore(numeric_limits<streamsize>::max(),'\n');//empty the buffer cout<<"You have entered wrong input"<<endl; cout << "Enter first number: "; cin >> num1; } if(!cin.fail()) break; } cout << "Enter second number: "; cin >> num2; while(1){ if(cin.fail()){ cin.clear(); cin.ignore(numeric_limits<streamsize>::max(),'\n'); cout<<"You have entered wrong input"<<endl; cout <<...

  • #include <iostream> #include <iomanip> #include <vector> #include <string> using namespace std; struct menuItemType { string menuItem;...

    #include <iostream> #include <iomanip> #include <vector> #include <string> using namespace std; struct menuItemType { string menuItem; double menuPrice; }; void getData(menuItemType menuList[]); void showMenu(menuItemType menuList[], int x); void printCheck(menuItemType menuList[], int menuOrder[], int x); int main() { const int menuItems = 8; menuItemType menuList[menuItems]; int menuOrder[menuItems] = {0}; int orderChoice = 0; bool ordering = true; int count = 0; getData(menuList); showMenu(menuList, menuItems); while(ordering) { cout << "Enter the number for the item you would\n" << "like to order, or...

  • #include <iostream> #include <cstdlib> #include <time.h> #include <string> using namespace std; int main() { srand(time (0));...

    #include <iostream> #include <cstdlib> #include <time.h> #include <string> using namespace std; int main() { srand(time (0)); int number, guess, response, reply; int score = 0 number = rand() % 100 + 1; do { do { cout << "Enter your guess "; cin >> guess; score++; if (guess < number) cout << guess << " is too low! Enter a higher number. "; else if (guess > number) cout << guess << " is too high! Enter a lower number....

  • #include<iostream> #include<string> #include<iomanip> using namespace std; /* ********* Class Car ************* ********************************* */ class Car {...

    #include<iostream> #include<string> #include<iomanip> using namespace std; /* ********* Class Car ************* ********************************* */ class Car { private: string reportingMark; int carNumber; string kind; bool loaded; string choice; string destination; public: Car() { reportingMark = ""; carNumber = 0; kind = "Others"; loaded = 0; destination = "NONE"; } ~Car() { } void setUpCar(string &reportingMark, int &carNumber, string &kind, bool &loaded, string &destination); }; void input(string &reportingMark, int &carNumber, string &kind, bool &loaded,string choice, string &destination); void output(string &reportingMark, int &carNumber,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT