Address any questions or misco

Programming Assignment 1

#include <iostream>

#include<iomanip>

#include<fstream>

#include<sstream>

#include<string.h>

using namespace std;

//Define the main function

int main()

{

    //Create the object of fstream class and opening the file

    ifstream inpfile(“order.txt”);

    string fline;

    double sub_total, tax, shipping=14.95, grand_total, line_total;

    double priceA=17.46, priceB=10.13, priceC=2.11, priceD=23.13, priceE=74.56, priceF=1.11, priceG=9.34, priceH=3.45;

    cout<<“Thank You! Your order is summarized below: “<<endl;

    cout<<“———————————————–“<<endl;

    cout<<“| Product\t|Quantity\t|Line total  |”<<endl;

    cout<<“———————————————–“<<endl;

    while (getline(inpfile, fline))  {

        istringstream ists(fline);

        string product;

        int quantity;

        if (!(ists >>product>> quantity)) {

            break;

        }

        else{

            if(product==”A”)

                line_total=quantity*priceA;

            else if (product==”B”)

                line_total=quantity*priceB;

            else if (product==”C”)

                line_total=quantity*priceC;

            else if (product==”D”)

                line_total=quantity*priceD;

            else if (product==”E”)

                line_total=quantity*priceE;

            else if (product==”F”)

                line_total=quantity*priceF;

            else if (product==”G”)

                line_total=quantity*priceG;

            else if (product==”H”)

                line_total=quantity*priceH;

            cout<<“| “<<setw(2)<<product<<“\t\t| “<<setw(2)<<quantity <<“\t\t| “<<fixed<<setprecision(2)<<setw(10)<<line_total<<setw(2)<<” |”<<endl;

            cout<<“———————————————–“<<endl;

            sub_total=sub_total+line_total;

        }

        tax=sub_total*0.17;

        grand_total=sub_total+tax+shipping;

    }

    cout<<“| “<<setw(2)<<“Sub_total”<<“\t| “<<setw(2)<<” ” <<“\t\t| “<<fixed<<setprecision(2)<<setw(10)<<sub_total<<setw(2)<<” |”<<endl;

    cout<<“———————————————–“<<endl;

    cout<<“| “<<setw(2)<<“Tax”<<“\t\t| “<<setw(2)<<” ” <<“\t\t| “<<fixed<<setprecision(2)<<setw(10)<<tax<<setw(2)<<” |”<<endl;

    cout<<“———————————————–“<<endl;

    cout<<“| “<<setw(2)<<“Shipping”<<“\t| “<<setw(2)<<” ” <<“\t\t| “<<fixed<<setprecision(2)<<setw(10)<<shipping<<setw(2)<<” |”<<endl;

    cout<<“———————————————–“<<endl;

    cout<<“| “<<setw(2)<<“Grand Total”<<“\t| “<<setw(2)<<” ” <<“\t\t| “<<fixed<<setprecision(2)<<setw(10)<<grand_total<<setw(2)<<” |”<<endl;

    cout<<“———————————————–“<<endl;

    inpfile.close();

    return 0;

}

Programming Assignment 2

#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;

int main()
{
    float lowerTemp,higherTemp,increment;
    cout<<“Please Enter the lower value for the conversion table (Celsius)”;
    cin>> lowerTemp;
    cout<<“Please Enter the higher value for the conversion table (Celsius)”;
    cin>> higherTemp;
    //input validation
    if(lowerTemp > higherTemp){
        cout<<“lower value should not greater that higher value”;
        return 1;
    }
    cout<<“what do you want to use for incremented value”;
    cin>> increment;
    if(increment <= 0){
        cout<<“The increament value should be greater than 0.”;
        return 1;
    }

    ofstream write_data;
    write_data.open(“conversion_table.txt”);
    if(!write_data) { //error
      cerr << “Error in opening the file.” << endl;
      exit(1);
    }

    //print heading
    write_data << “C \t F \t N” <<endl;
    //compute temp equivalent
    //save data into the file
    while (lowerTemp <= higherTemp){
        float f = (9/5) * lowerTemp + 32;
        float n = 0.33 * lowerTemp;
        write_data << fixed << setprecision(2) <<lowerTemp << “\t” <<
        setprecision(2) << f << “\t” << setprecision(2) << n <<endl;
        lowerTemp += increment;
    }
    cout<<“\nData is saved in the file.”;
    write_data.close();
    return 0;
}

 

 

Question-

    • Address any questions or misconceptions the reviewer may have posted. (I like your program! I don’t see very many things to nitpick at. Perhaps, instead of using “cout << “—————” << endl;” you could use something along the lines of “cout << setw(10) << setfill(‘-‘) << “-” << endl;” in case you wanted to change that part or prevent changes to how it looks on different screens. Good job on the comments and everything.) 
    • Indicate how useful the feedback was. 
    • Did you understand the comments/observations/suggestions?
    • Did the review point out flaws/shortcomings in your program?
    • Did you learn anything from the critique?
    • Did the process help you better understand the original programming assignment? would you modify your program based on the feedback/observations?

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more