Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Fabrication Cost 1. This program will determine how much it will cost to fabricate a particular number of units of an item. The program

C++

Fabrication Cost

1. This program will determine how much it will cost to fabricate a particular number of units of an item. The program will read in the name of the company purchasing the units and then from the number of units, the cost of each unit, and a percent markup, the program will calculate a total cost. There is also a setup cost of $3575.95 that is added in no matter how many units are purchased.

Specifically, the total cost is the cost of all of the units plus the markup percentage (i.e. if there is a 25% markup, you are paying 25% more than the cost of the units). The setup cost ($3575.95) is not affected by the markup (just the cost of the units). See the example below for more specifics.

You will need to create a .cpp file with a main function.

2. You are required to write at least 4 tests for your program. You need to specify the name of the company, the number of units, the cost per unit, and the percent markup for each test and then calculate the total cost. You will use these to check the correctness of your program. (As a note, you cannot use the example given below.)

Make sure you try a variety of values that might cause problems.

Put these in the comments for your class so they are easy to find. You can do something similar to what was done in Lab 02.

3. To get full credit, you must meet the following requirements: a. The program must read in the data from cin. The order of the inputs must be name of

company, units, cost per unit, and then percent markup. The percent markup will be

read in as a decimal (i.e. an input of 0.15 is 15%; an input of 15 is 1500%). (What types are the other values?)

While negative numbers may not seem reasonable here, they will be allowed (and therefore, you may have a negative total).

Important Note: The name of the company may have spaces in it, so make sure you account for that when reading in the name.

b. Output the values read in (name of company, number of units, cost per unit, and

percent markup) and the computed total. The output must be formatted. The costs

must be formatted so that they have two places after the decimal, a width of at least

10 and are right aligned. They do not need to have a dollar sign. Each value should be labeled.

The markup should be formatted as a percent. It should have one place after the

decimal, a width of at least 8, and be right aligned. There should be a % after the markup.

Important Note: An input of 0.15 should be displayed as 15%, so make sure you handle that in the output.

c. The setup cost needs to be declared as a constant.

d. The file and main method need to be documented in Doxygen comments.

e. Your output may look something like the example below (but it does not have to). In this case, the name of the company is Billys Emporium, the cost for the units is $16,875 and the 15% markup adds in another $2,531.25. With the $3575.95 setup cost, it brings the total to $22,982.20.

Example:

Enter the company name: Billys Emporium

Enter the number of units: 4500

Enter the cost per unit: 3.75

Enter the percent markup: 0.15

Billys Emporium

Units: 4500

Cost Per: 3.75

Markup: 15.0%

Total Cost: 22982.20

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Part 2

C++

5. Create a program to compute the value of xy+2 ( nominator) over x2+1 ( dominator ) and display the result. x and y will be the inputs to the program.

6. You must create at least 4 tests for this program and include them in the comments. For each test, pick an x and y calculate the result. As before, try values that may cause problems.

7. To get full credit, you must meet the following requirements:

a. The program must read in the data from cin. The order of the inputs must be x and then y. Both values should be ints.

b. Calculate the result of the equation shown above. Be careful about how you write the expression so you get the result you want.

c. Output the values read in (x and y) and the computed value. The computed value must be formatted so that it has 3 decimal places.

d. The file and main method need to be documented in Doxygen comments.

e. Your output may look something like the example below (but it does not have to).

Example:

Enter the value of x: 3

Enter the value of y: 5

Using x = 3 and y = 5, the result is 1.700

9. Format all of your classes. You can select the text in a file and press Ctrl + K, Ctrl + D. This will do most of it for you.

10. Hint: If you used a function to do some of the computations, make sure you #include the appropriate header file, even if it works in Visual Studio. It is important to do this to make sure the code compiles under different compilers (like the one used on Web-CAT). As a corollary, if your code works on your machine but does not compile on Web-CAT, it may be because you are missing one of the #includes.

11. Using the instructions in the next section, submit your .cpp files to Web-CAT. You will need to submit each file separately to the corresponding assignment on Web-CAT. (Each main function must be in a separate project, so they need to be submitted separately.) View the feedback from Web-CAT and view your score. If you did not receive full points, look at the files that have errors. Make any corrections you need and resubmit until you get full points.

Notices, hints and suggestions

Commenting and Formatting

Make sure you format your code before you submit. o Ctrl + K, Ctrl + D will do most of it for you automatically in Visual Studio.

Ensure that your Doxygen comments are there and that all the required tags are there too. o You need a file comment for each file and a function comment for each main function. o The int return value with the main function indicates an error in the program. 0 is returned if no error occurred. You can describe that with the @return tag in the Doxygen comment. Take a look at the examples in the notes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

Students also viewed these Databases questions