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

Show answer step by step csc126 Fall 2017 FinalA points) Write including and tha

ID: 3843489 • Letter: S

Question

Show answer step by step csc126 Fall 2017 FinalA points) Write including and that accomplishes the task indicated below. Use good form by Be accurate with the syntax as if you were program the program on the computer. Assume that there is a nue on disk named Booka that contains information the books sold at of that book Each line contains an ISBN number, and a count that indicates how many was sold. Here is a sample for the first two lines in the file 638-0-321-83389-1 230-0-328-83345-0 first line means that 18o copies of the book with ISBN number 638-o-321-83389-1 were sold. Write the program with the assumption that you do not know how many lines are in the list. You do not need to use arrays for this program. Write a C++ program that will do the following:

Explanation / Answer

Edit &

  include <iostream>  #include <fstream>  #include <cstdlib>  #include <iomanip>    //Obtain the name of the data file and attempt to open it for reading    void openFile()  {    cout << "Book Sale Calculator" << endl;    cout << "==============================" << endl;    ifstream fp;    fp.open ("books.dat");    if (!fp)      {        cout << "Error opening the file" << endl;        exit (EXIT_FAILURE);      }  }    //Obtain all input for each sale from the data file and return merchandise total and shipping method for the sale being processed    void obtainInput()  {    while (books != 0)      {        int books;        char shipping_method;        float price; subtotal=0; shipping_price;        for (int i=0; i<=books; i++)          fp >> books;          fp >> shipping_method;          for (int i=0; i <= books; i++)            {              fp >> price;            }     subtotal+ = price[i];      }      if (shipping_method == 'S')      {        shipping_price = 4.99;      }    else      {        shipping_price = 12.99;      }  }    //Calculate tax, discount, shipping and total      void calculateOutput()  {    float tax;    tax = subtotal * .05;      float discount;    if (subtotal < 50)      {        discount = 0.00;      }    else if (subtotal >= 50 && subtotal <= 100)      {        discount = subtotal * .10;      }    else      {        discount = subtotal * .15;      }      float total;    total = subtotal + tax - discount + shipping_price;  }  //Display a final summary    void displaySummary()  {    cout << "The summary for the order is as follows:" << endl;    cout << fixed << showpoint << setprecision (2);    cout << "Subtotal:" << subtotal << endl;    cout << fixed << showpoint << setprecision (2);    cout << "Tax:" << tax << endl;    cout << fixed << showpoint << setprecision (2);    cout << "Discount:" << discount << endl;    cout << fixed << showpoint << setprecision (2);    cout << "Shipping:" << shipping_price << endl;    cout << fixed << showpoint << setprecision(2);    cout << "Total:" << total << endl;  }    int main ()    openFile();  obtainInput();  calculateOutput();  displaySummary();    return 0;  }  

Edit &