Problem specification: This program extends Program assignment 3 so you will be able to use code from your Program 3 as

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Problem specification: This program extends Program assignment 3 so you will be able to use code from your Program 3 as

Post by answerhappygod »

Problem specification:
This program extends Program assignment 3 so
you will be able to use code from your Program 3 as a basis for
Program 4. Essentially, you are inserting a loop in Program 3 to
make it process multiple input values (number of copies sold, and
expected selling price) in one execution. On each pass through the
loop, one set of input values is processed, and the output on the
options is produced; then, a new set of input values is read. The
loop repeats until there are no more input values in the input
file.
Use file input and output.
Input: The input file has an unknown
number of lines with the expected number of copies sold, and the
expected selling price, starting on the second line of
the file. The first line, which must be bypassed, has labels on it.
For example, the input file may contain:
Copies
Sold Selling
Price
4360 35.29
10500 20.99
50000 7.50
38500 104.00
Output: For each line of inputs, the output
file displays the inputs used in the calculation, the amount paid
to the author under each option, and the best option for the
author. A sample output style could be:
For ______ copies sold at a price of $ ________ , the author is
paid
$ ___________ under Option 1
$ ___________ under Option 2
$ ___________ under Option 3
Option ___ is the best choice.
Be sure there is at least one blank line between the output for
each input case.
Important: You must
use only C++ features in Chapters 2, 3,
4, 5 and 6 (value-returning functions part only)
as needed to meet requirements.
For your reference, the directions for Program 3 are
shown below. (The Program 4 Directions, above, tell how to modify
Program 3 to create Program 4.)
An author is negotiating a contract for a new
novel. The publisher is offering three
options.
Option
1. The author is paid $5,000 upon delivery of
the manuscript and $20,000 when the novel is published.
Option
2. The author is paid 12.5% of the net price of
the novel for each copy of the novel sold.
Option
3. The author is paid 10% of the net price for
the first 4000 copies sold, and 14% of the net price for the copies
sold over 4000.
Write a program that reads, from a file, the net price of each
copy of the novel and the estimated number of copies that will be
sold. The program outputs, to a file, the author’s royalties
(income) under each option, and identifies the best option the
author could choose.
Use appropriate named constants to store the special values such
as royalties rates in Options 2 and 3 and the fixed royalties in
Option 1.
Use ios::app to append the results of successive runs to the
output file. Run enough cases that each option is the best in one
case, for some input.
Output: For ease in checking results, the output should include
the net price of the novel and the estimated number sold. The
values to be output represent money; they need the dollar sign and
two decimal places when output. Labels in English should clearly
identify which Option produced which value, and a concluding output
statement identifies the best option.
Program 4 Report Items
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply