[Solved]Lab Lesson Writing Program Hypothetical Acme Wholesale Copper Wire Company Acme Company Se Q37157935




This lab lesson you are writing a program for the hypothetical Acme Wholesale Copper Wire Company. The Acme company sells spools of copper wiring for $100 each. Write a program that displays the status of an order This program will be reading in from cin and writing to cout In this program you will need at least three functions, including main as one of the three. You must use function prototypes for all of the functions (except main) Read function You need to have a function that reads in the following data: The number of spools ordered The number of spools currently in stock . .Any special shipping and handling charges (see description below) Your program needs to prompt for these values. The prompts are below under Sample with special shipping and handling Do not accept a number less than 1 for the number of spools ordered. . . Do not accept a number less than 0 for the number of spools in stock Do not accept a shipping and handling charge of less than 0 . For each of these cases you will have to have a loop that issues an error message, prompts for the input value again, and checks the data for validity The normal shipping and handling is $11.88 per spool. You will have to ask if there is special shipping and handling. If there is you will need to read in the special shipping and handling charge Here are a couple of sample runs. One with the default shipping and handling and one with special shipping and handling Sample with default shipping Assume the following input from cin: 10 100 Here are the prompts to read in the spools to be ordered, spools in stock and shipping and handling: Spools to be ordered Spools in stock Special shipping and handling (y or n) Sample with special shipping and handling Assume the following input from cin: 10 100 9.99 Here is the output or the prompts to cout Spools to be ordered Spools in stock Special shipping and handling (y or n) Shipping and handling amount Note that the Shipping and handling amount prompt is only written out if the input from cin was y from the Special shipping and handling (y or n) prompt If the input from the Shipping and handling amount is any value other than y (lower case y) you can assume the default shipping and handling amount. There is not validity checking for this value other than y and any other value (meaning no special shipping and handling) The display function needs to display e the number of spools (ordered) that are ready to ship from the current stock e the number of spools on back-order (if the numbered ordered is greater than what is in stock) the subtotal of the spools ready to ship (the number ready to ship times $100) the total shipping and handling charges for the spools ready to ship the total of the order ready to ship The display function will output these values to cout Assume the number of spools ordered is 9 and there are 5 spools in stock. Assume the shipping cost is $10. The output would be as follows. All of the amounts should have two digits to the right of the decimal point and a leading $ character The total width of the number (not including the $ character) is 10 characters. Spools to be ordered Spools in stock Special shipping and handling (y or n) Shipping and handling amount Spools ready to ship:5 Spools on back-order: 4 Subtotal ready to ship: $ Shipping and handling: $ Total shipping charges: $ 500.00 50.00 550.00 The main function The main function is fairly simple. You need to call the read function and then pass the updated values to the display function. Here are some sample runs: Sample run # 1 (valid input with special handling) Assume the following is read in from cirn 10.0 The contents of cout Spools to be ordered Spools in stock Special shipping and handling (y or n) Shipping and handling amount Spools ready to ship: 5 Spools on back-order: 4 Subtotal ready to ship: $ Shipping and handling: $ Total shipping charges: $ 500.00 50.00 550.00 Sample run # 2 (valid input, no special handling) The following is read in from cin 35 35 The following would be written to cout Spools to be ordered Spools in stock Special shipping and handling (y or n) Spools ready to ship: 35 Spools on back-order:0 Subtotal ready to ship:3500.00 Shipping and handling: $ Total shipping charges:$3915.80 415.80 Sample run # 3 (invalid input) Assume the following is read in from cin 200 12 0.01 5.99 The contents of cout after the run: Spools to be ordered Spools order must be 1 or more Spools to be ordered Spools in stock Spools in stock must be 0 or more Spools in stock Special shipping and handling (y or n) Shipping and handling amount The spool shipping and handling charge must be 0.0 or more Shipping and handling amount Spools ready to ship: 12 Spools on back-order: 188 Subtotal ready to ship: 1200.00 Shipping and handling: Total shipping charges: $1271.8 71.88 Failure to follow the requirements for lab lessons can result in deductions to your points, even if you pass the validation tests. Logic errors, where you are not actually implementing the correct behavior, can result in reductions even if the test cases happen to return valid answers. This will be true for this and all future lab lessons Expected output There are six tests. Each test will have a new set of input data. You must match, exactly, the expected output. You will get yellow highlighted text when you run the tests if your output is not what is expected. This can be because you are not getting the correct result. It could also be because your formatting does not match what is required. The checking that zyBooks does is very exacting and you must match it exactly. More information about what the yellow highlighting means can be found in course “How to use zyBooks- especially section “1.4 zyLab basics”. Finally, do not include a system(“pause”)statement in your program. This will cause your verification steps to fail Note: that the system(“pause”)command runs the pause command on the computer where the program is running The pause command is a Windows command. Your program will be run on a server in the cloud. The cloud server may be running a different operating system (such as Linux). Error message “Could not find main function Now that we are using functions some of the tests are unit tests. In the unit tests the zyBooks environment will call one or more of your functions directly. To do this it has to find your main function. Right now zyBooks has a problem with this when your int main0 statement has a comment on it For example: If your main looks as follows int main) // main function You will get an error message: Could not find main function You need to change your code to: // main function int main) If you do not make this change you will continue to fail the unit tests Show transcribed image text This lab lesson you are writing a program for the hypothetical Acme Wholesale Copper Wire Company. The Acme company sells spools of copper wiring for $100 each. Write a program that displays the status of an order This program will be reading in from cin and writing to cout In this program you will need at least three functions, including main as one of the three. You must use function prototypes for all of the functions (except main) Read function You need to have a function that reads in the following data: The number of spools ordered The number of spools currently in stock . .Any special shipping and handling charges (see description below) Your program needs to prompt for these values. The prompts are below under Sample with special shipping and handling Do not accept a number less than 1 for the number of spools ordered. . . Do not accept a number less than 0 for the number of spools in stock Do not accept a shipping and handling charge of less than 0 . For each of these cases you will have to have a loop that issues an error message, prompts for the input value again, and checks the data for validity The normal shipping and handling is $11.88 per spool. You will have to ask if there is special shipping and handling. If there is you will need to read in the special shipping and handling charge Here are a couple of sample runs. One with the default shipping and handling and one with special shipping and handling Sample with default shipping Assume the following input from cin: 10 100 Here are the prompts to read in the spools to be ordered, spools in stock and shipping and handling: Spools to be ordered Spools in stock Special shipping and handling (y or n) Sample with special shipping and handling Assume the following input from cin: 10 100 9.99 Here is the output or the prompts to cout Spools to be ordered Spools in stock Special shipping and handling (y or n) Shipping and handling amount Note that the Shipping and handling amount prompt is only written out if the input from cin was y from the Special shipping and handling (y or n) prompt If the input from the Shipping and handling amount is any value other than y (lower case y) you can assume the default shipping and handling amount. There is not validity checking for this value other than y and any other value (meaning no special shipping and handling)
The display function needs to display e the number of spools (ordered) that are ready to ship from the current stock e the number of spools on back-order (if the numbered ordered is greater than what is in stock) the subtotal of the spools ready to ship (the number ready to ship times $100) the total shipping and handling charges for the spools ready to ship the total of the order ready to ship The display function will output these values to cout Assume the number of spools ordered is 9 and there are 5 spools in stock. Assume the shipping cost is $10. The output would be as follows. All of the amounts should have two digits to the right of the decimal point and a leading $ character The total width of the number (not including the $ character) is 10 characters. Spools to be ordered Spools in stock Special shipping and handling (y or n) Shipping and handling amount Spools ready to ship:5 Spools on back-order: 4 Subtotal ready to ship: $ Shipping and handling: $ Total shipping charges: $ 500.00 50.00 550.00 The main function The main function is fairly simple. You need to call the read function and then pass the updated values to the display function. Here are some sample runs: Sample run # 1 (valid input with special handling) Assume the following is read in from cirn 10.0 The contents of cout Spools to be ordered Spools in stock Special shipping and handling (y or n) Shipping and handling amount Spools ready to ship: 5 Spools on back-order: 4 Subtotal ready to ship: $ Shipping and handling: $ Total shipping charges: $ 500.00 50.00 550.00 Sample run # 2 (valid input, no special handling) The following is read in from cin 35 35
The following would be written to cout Spools to be ordered Spools in stock Special shipping and handling (y or n) Spools ready to ship: 35 Spools on back-order:0 Subtotal ready to ship:3500.00 Shipping and handling: $ Total shipping charges:$3915.80 415.80 Sample run # 3 (invalid input) Assume the following is read in from cin 200 12 0.01 5.99 The contents of cout after the run: Spools to be ordered Spools order must be 1 or more Spools to be ordered Spools in stock Spools in stock must be 0 or more Spools in stock Special shipping and handling (y or n) Shipping and handling amount The spool shipping and handling charge must be 0.0 or more Shipping and handling amount Spools ready to ship: 12 Spools on back-order: 188 Subtotal ready to ship: 1200.00 Shipping and handling: Total shipping charges: $1271.8 71.88 Failure to follow the requirements for lab lessons can result in deductions to your points, even if you pass the validation tests. Logic errors, where you are not actually implementing the correct behavior, can result in reductions even if the test cases happen to return valid answers. This will be true for this and all future lab lessons
Expected output There are six tests. Each test will have a new set of input data. You must match, exactly, the expected output. You will get yellow highlighted text when you run the tests if your output is not what is expected. This can be because you are not getting the correct result. It could also be because your formatting does not match what is required. The checking that zyBooks does is very exacting and you must match it exactly. More information about what the yellow highlighting means can be found in course “How to use zyBooks- especially section “1.4 zyLab basics”. Finally, do not include a system(“pause”)statement in your program. This will cause your verification steps to fail Note: that the system(“pause”)command runs the pause command on the computer where the program is running The pause command is a Windows command. Your program will be run on a server in the cloud. The cloud server may be running a different operating system (such as Linux). Error message “Could not find main function Now that we are using functions some of the tests are unit tests. In the unit tests the zyBooks environment will call one or more of your functions directly. To do this it has to find your main function. Right now zyBooks has a problem with this when your int main0 statement has a comment on it For example: If your main looks as follows int main) // main function You will get an error message: Could not find main function You need to change your code to: // main function int main) If you do not make this change you will continue to fail the unit tests
Expert Answer
Answer to This lab lesson you are writing a program for the hypothetical Acme Wholesale Copper Wire Company. The Acme company sell… . . .
OR

