Draw a flow chart according coding statement below. #include #include #include #include using namespace std; //calcAccommodation function int calcAccommodation(char accommodation, int days, char nationality) {     int price = 0;     //calculate price according to local or international     if (nationality == 'L')     {         price = days * 150;     }     else     {         price = days * 100;     }     return price; } //calcFee Function void calcFee(char category, char nationality, int& fees) {     //local presenter or observer     if (nationality == 'L')     {         if (category == 'P')             fees = 990;         else             fees = 600;     }     //international presenter or observer     else     {         if (category == 'P')             fees = 260;         else             fees = 150;     } } //printInvoice function void printInvoice(int No, char name[], char category, char accommodation, int totalCharge, float fees, float price, char nationality) {     float tot = 0;     //declare output file      ofstream output;     //open file and check for error     output.open("Output.txt", ios::app);     if (output.fail())     {         cout << "The onput file cannot be opened" << endl;         exit(-1);     }     //total charge if local or international     if (nationality == 'L')         tot = totalCharge;     else         tot = totalCharge * 4.2;     //output to file      output << "------------------------------------------------" << endl;     output << "International Conference on" << endl;     output << "Mathematical Sciences and Technology (MathTech)" << endl;     output << "------------------------------------------------" << endl;     output << "\nInvoice Date          : 20 January 2020" << endl;     output << "Invoice No            : " << setw(4) << setfill('0') << No << endl; No++;     output << "Name                  : " << name << endl;     if (category == 'L') {         output << "Category              : " << "Local" << endl;     }     else {         output << "Category              : " << "International" << endl;     }     if (accommodation == 'Y') {         output << "Accomodation (Y/N)    : " << "Yes" << endl;     }     else {         output << "Accomodation (Y/N)    : " << "No" << endl;     }     output << setiosflags(ios::showpoint);     output << fixed << setprecision(2);     output << "\nConference Fee        : " << fees << endl;     output << "Accommodation Fee     : " << price << endl;     output << "Total Amount Due (RM) : " << tot << endl;     output << "\nTerms & Conditions" << endl;     output << "Payment is due within 30 days." << endl;     output << "Please make payment via online banking to" << endl;     output << "Maths USM (RHB: 1234554321)" << endl;     output << "\n**************************************************" << endl;     output.close(); } int main() {     char name[30], accommodation, nationality, category;     int days = 0, fees, totalCharge, price = 0, No = 0001;     ifstream input;     void calcFee(char, char, int&);     int calcAccommodation(char, int, char);     //open file and check      input.open("File.txt");     if (input.fail())     {         cout << "The input file cannot be opened" << endl;         exit(-1);     }     //for every entry in the file     for (int i = 1; i <= 5; i++) {         //get name into name array         input.getline(name, 30);         //get details into each variables         input >> category >> nationality >> accommodation >> days;         price = calcAccommodation(accommodation, days, nationality);         calcFee(category, nationality, fees);         totalCharge = price + fees;         printInvoice(No, name, category, accommodation, totalCharge, fees, price, nationality);         //ignore the input          input.ignore();         //increase invoice number         No++;     }     //close file     input.close(); }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Draw a flow chart according coding statement below.

#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdlib.h>

using namespace std;

//calcAccommodation function
int calcAccommodation(char accommodation, int days, char nationality)
{
    int price = 0;

    //calculate price according to local or international
    if (nationality == 'L')
    {
        price = days * 150;
    }
    else
    {
        price = days * 100;
    }

    return price;
}

//calcFee Function
void calcFee(char category, char nationality, int& fees)
{
    //local presenter or observer
    if (nationality == 'L')
    {
        if (category == 'P')
            fees = 990;
        else
            fees = 600;
    }
    //international presenter or observer
    else
    {
        if (category == 'P')
            fees = 260;
        else
            fees = 150;
    }
}

//printInvoice function
void printInvoice(int No, char name[], char category, char accommodation, int totalCharge, float fees, float price, char nationality)
{
    float tot = 0;

    //declare output file 
    ofstream output;

    //open file and check for error
    output.open("Output.txt", ios::app);
    if (output.fail())
    {
        cout << "The onput file cannot be opened" << endl;
        exit(-1);
    }

    //total charge if local or international
    if (nationality == 'L')

        tot = totalCharge;
    else
        tot = totalCharge * 4.2;

    //output to file 
    output << "------------------------------------------------" << endl;
    output << "International Conference on" << endl;
    output << "Mathematical Sciences and Technology (MathTech)" << endl;
    output << "------------------------------------------------" << endl;

    output << "\nInvoice Date          : 20 January 2020" << endl;
    output << "Invoice No            : " << setw(4) << setfill('0') << No << endl; No++;
    output << "Name                  : " << name << endl;

    if (category == 'L') {
        output << "Category              : " << "Local" << endl;
    }
    else {
        output << "Category              : " << "International" << endl;
    }

    if (accommodation == 'Y') {
        output << "Accomodation (Y/N)    : " << "Yes" << endl;
    }
    else {
        output << "Accomodation (Y/N)    : " << "No" << endl;
    }


    output << setiosflags(ios::showpoint);
    output << fixed << setprecision(2);
    output << "\nConference Fee        : " << fees << endl;
    output << "Accommodation Fee     : " << price << endl;
    output << "Total Amount Due (RM) : " << tot << endl;


    output << "\nTerms & Conditions" << endl;
    output << "Payment is due within 30 days." << endl;
    output << "Please make payment via online banking to" << endl;
    output << "Maths USM (RHB: 1234554321)" << endl;

    output << "\n**************************************************" << endl;

    output.close();
}

int main()
{
    char name[30], accommodation, nationality, category;
    int days = 0, fees, totalCharge, price = 0, No = 0001;

    ifstream input;

    void calcFee(char, char, int&);
    int calcAccommodation(char, int, char);

    //open file and check 
    input.open("File.txt");
    if (input.fail())
    {
        cout << "The input file cannot be opened" << endl;
        exit(-1);
    }

    //for every entry in the file
    for (int i = 1; i <= 5; i++) {
        //get name into name array
        input.getline(name, 30);
        //get details into each variables
        input >> category >> nationality >> accommodation >> days;

        price = calcAccommodation(accommodation, days, nationality);
        calcFee(category, nationality, fees);
        totalCharge = price + fees;
        printInvoice(No, name, category, accommodation, totalCharge, fees, price, nationality);

        //ignore the input 
        input.ignore();

        //increase invoice number
        No++;
    }

    //close file
    input.close();
}

Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY