Question

1 Normal 1 No Spac. Heading 1 Heading 2 TitleSubtitle Subtle Em... .Emphe 2 Title Styles Ch 6 Programming Challenge 14: Order
media%2F0c0%2F0c0b81e2-3c85-4260-9e36-96
0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include<iostream>
#include<iomanip>
using namespace std;
int numOrdered, numInStock, specialChargeAmount;
bool specialCharge;
void getInput();
int main() {
        int shippingCharges = 0, toBeShip;
        getInput();
        
        if (numOrdered > numInStock)
                toBeShip = numInStock;
        else
                toBeShip = numOrdered;
        cout << "Order Summary" << endl;
        cout << "===============================" << endl;
        cout << setw(25)<<left << "Items ordered: ";
        cout << numOrdered << endl;
        cout << setw(25)<<left << "Ready to ship: ";
        cout <<numInStock << endl;
        if (numOrdered > numInStock) {
                cout << setw(25)<<left << "On backorder: ";
                cout << numOrdered - numInStock << endl;
        }
        cout << endl;
        cout << setw(25)<<left << "Subtotal: "<<"$";
        cout <<toBeShip * 100 << endl;
        cout << setw(25)<<left << "Shipping charge: "<<"$";
        if (specialCharge) {
                shippingCharges = toBeShip * specialCharge;
                cout << shippingCharges << endl;
        }
        cout << setw(25)<<left << "Total due: "<<"$";
        cout << shippingCharges + toBeShip * 100 << endl;
        system("pause");
        return 0;
}
void getInput() {
        do {
                cout << "How many spools were ordered? ";
                cin >> numOrdered;
        } while (numOrdered < 1);
        do {
                cout << "How many spools are in stock? ";
                cin >> numInStock;
        } while (numInStock < 1);
        char option;
        cout << "Are special shipping charges required? (y/n) : ";
        cin >> option;
        if (option == 'y') {
                specialCharge = true;
                cout << "Enter the amount of any special shipping charges: ";
                cin >> specialChargeAmount;
        }
}

CAUsers VIBHAMDocuments\ Visual Studio 2015\Projects\Chegg\Debug\Chegg.exe How many spools were ordered? 10 How many spools a

Add a comment
Know the answer?
Add Answer to:
1 Normal 1 No Spac. Heading 1 Heading 2 TitleSubtitle Subtle Em... .Emphe 2 Title Styles...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • this is c plus plus the middletown wholesale copper wire company sells spools of copper wiring...

    this is c plus plus the middletown wholesale copper wire company sells spools of copper wiring for 100 each and ships them for 10 a piece. write a program that displays the status of an order. it should use two functions in addition to function main(). the first function asks for the following date and stores the input values in reference parameters. the number of spools ordered. the number of spools in stock. Any special shipping and handing charges. the...

  • The One Stop Fabric Shop sells 80 yards bolt of fabric for $100 each. Your job...

    The One Stop Fabric Shop sells 80 yards bolt of fabric for $100 each. Your job is to write a program that provides an invoice to a customer that will also include information on anything that might be back ordered. The program should have a function that asks for the following data: Customer information (include name, mailing address and phone number) The number of bolts ordered. The number of bolts in stock. Whether there are special shipping and handling charges....

  • 1 Normal 1 No Spac... Heading 1 Heading 2 Title Subtitle Subtle Em...Emphasis Int Styles 1)...

    1 Normal 1 No Spac... Heading 1 Heading 2 Title Subtitle Subtle Em...Emphasis Int Styles 1) Create a PYHW3 document that will contain your algorithms in flowchart and pseudocode form along with your screen shots of the running program 2) Create the algorithms in both flowchart and pseudocode forms for the following: A. Write a Python function that receives miles driven and gallons of gas used and returns miles per gallon. B. Write a Python program where the main function...

  • 1 Normal 1 No Spac... Heading 1 Heading 2 Title Subtitle Subtle Em... EmphasisIn Paragrap Styles...

    1 Normal 1 No Spac... Heading 1 Heading 2 Title Subtitle Subtle Em... EmphasisIn Paragrap Styles 1. What is the third intermediate in the following overall synthesis? 0 он a. b. d. e. CHyI 2. Which intermediate reacts with CHJl in the following synthesis?79 b. C. d. e. not a.-cd 3. What would be the best reaction sequence to make the following ketone? a. cyclohexanone + LDA + CHal + LDA + (CHa)SiCI + (CHs).cal/zncl b. LDA + cyclohexa none...

  • Normal No Spac... Heading! Heading 2 Title Font Paragraph Select Editing Styles 1. Compute the activity...

    Normal No Spac... Heading! Heading 2 Title Font Paragraph Select Editing Styles 1. Compute the activity rate for each activity pool Activity Cost Pool Estimated Overhead Cost Machine Setups $21.500 Expected Activity Comprehensive Problem II - Worth 50 points Part 1 Performance Products Corporation makes two products. Titanium Rims and Posts Data regarding the two products is provided in the following table: Direct Labor Hours per Unit Annual Production Activity Beste Special Processing $120.000 4000 General factory 0.40 20.000 un...

  • Normal 1 No Spac... Heading 1 Heading 2 Title Subtitle Subtle Em... Emphasis intense - XX...

    Normal 1 No Spac... Heading 1 Heading 2 Title Subtitle Subtle Em... Emphasis intense - XX A..A. EEEE. - - Hi-Tek Manufacturing, Inc. makes two types of industrial component parts-the 3300 and the 1500. An absorption costing income statement for the most recent period is shown HI-Tek Manufacturing Inc. Income Statement Cost of goods sold Gross margin Selling and administrative expenses et operating loss 1,264,161 Hi-Tek produced and sold 60 200 units of B300 at a price of $20 per...

  • show work 9. - Normal 1 No Spac.. Heading 1 Heading 2 aragraph Styles Advanced Technologies...

    show work 9. - Normal 1 No Spac.. Heading 1 Heading 2 aragraph Styles Advanced Technologies (AT) produces two compression machines that are popular with manufacturers of plastics: no. 165 and no. 172. Machine no. 165 has an average selling price of $60,000, whereas no 172 typically sells for approximately $55,000. The company is very concerned about quality and has provided the following information Act Recorded Conte Al Cast Production Setup Number of Production Rams 60.000 Order Process Number of...

  • solve all questions simply by using Matlab writh all steps here please 1 Normal 1 No Spac.. Heading 1 Heading2 Title Subtitle Subtle Em... Ep Paragraph Styles 7. Write an M-file that creates subpl...

    solve all questions simply by using Matlab writh all steps here please 1 Normal 1 No Spac.. Heading 1 Heading2 Title Subtitle Subtle Em... Ep Paragraph Styles 7. Write an M-file that creates subplots (not superimposed) of Yfor n[:5) and X= [-10 : 0.01 : 101. Each subplot's Y axis should have an appropriate title. 8. Write a Matlab program to calculate the values of the function ro-ssint for all t where sint >0 f(t)=t0 elsewhere. 6π at intervals of...

  • E AaBbCcDd AaBbCcDd AaBbC AaBbCcD AaB 1 No Spac.... Heading 1 1 Normal Heading 2 Title...

    E AaBbCcDd AaBbCcDd AaBbC AaBbCcD AaB 1 No Spac.... Heading 1 1 Normal Heading 2 Title Paragraph Styles Read and respond to it It always surprises me the vast amount of information you can out of a graph or chart. When reviewing the chart, I have come to the conclusion that by 1780, the two states that had the majority of the black community was Virginia and South Carolina. This fact alone proved to me how in the dark I...

  • AaBbCcDd AaBbCcDd AaBbC AaBbCcD Normal 1 No Spac.. Heading 1 Heading 2 Title Subtitle S Paragraph...

    AaBbCcDd AaBbCcDd AaBbC AaBbCcD Normal 1 No Spac.. Heading 1 Heading 2 Title Subtitle S Paragraph Styles Read and respond to the below article and give your opinion? One of the topics from Chapter 12 that can be used to enhance a speech is clarity. Clarity can definitely lead to a less boring speech. It allows the audience to actively listen to you, without getting uninterested. In addition, it makes them eager to hear more of your speech. It is...

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