Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am having issues with this question , it is computer programming class and we are using C + + programming. can you correct this
I am having issues with this question it is computer programming class and we are using C programming. can you correct this program? Use C programming to redo program
Redo Programming Exercise of Chapter so that all the named constants are defined in a namespace royaltyRates.
Instructions for Programming Exercise of Chapter have been posted below for your convenience.
Exercise
A new author is in the process of negotiating a contract for a new romance novel. The publisher is offering three options. In the first option, the author is paid $ upon delivery of the final manuscript and $ when the novel is published. In the second option, the author is paid of the net price of the novel for each copy of the novel sold. In the third option, the author is paid of the net price for the first copies sold, and of the net price for the copies sold over The author has some idea about the number of copies that will be sold and would like to have an estimate of the royalties generated under each option. Write a program that prompts the author to enter the net price of each copy of the novel and the estimated number of copies that will be sold. The program then outputs the royalties under each option and the best option the author could choose. Use appropriate named constants to store the special values such as royalty rates and fixed royalties.
Status: FAILED!
Check:
Test: Successful Output
Reason: Unable to find Royalty option: 'Royalty option: 'Royalty option: in the program's output.
Enter the net price of each copy of the novel: $Enter the estimated number of copies that will be sold: Royalties under Option : $
Royalties under Option : $
Royalties under Option : $
Option is the best choice.
Error : AssertionError Unable to find Royalty option: in the program's output.
Timestamp: ::
Status: FAILED!
Check:
Test: Successful Output II
Reason: Unable to find Royalty option: 'Royalty option: 'Royalty option: in the program's output.
Enter the net price of each copy of the novel: $Enter the estimated number of copies that will be sold: Royalties under Option : $
Royalties under Option : $
Royalties under Option : $
Option is the best choice.
Error : AssertionError Unable to find Royalty option: in the program's output.
Timestamp: ::
#include
namespace royaltyRates
const double OptionFixed ;
const double OptionVariable ;
const double OptionRate ;
const double OptionRateUpTo;
const double OptionRateAbove;
const int OptionThreshold ;
using namespace std;
int main
double netPricePerCopy;
int estimatedCopiesSold;
cout "Enter the net price of each copy of the novel: $;
cin netPricePerCopy;
cout "Enter the estimated number of copies that will be sold: ;
cin estimatedCopiesSold;
Option calculation
double optionRoyalties royaltyRates::OptionFixed royaltyRates::OptionVariable;
Option calculation
double optionRoyalties royaltyRates::OptionRate netPricePerCopy estimatedCopiesSold;
Option calculation
double optionRoyalties ;
if estimatedCopiesSold royaltyRates::OptionThreshold
optionRoyalties royaltyRates::OptionRateUpTo netPricePerCopy estimatedCopiesSold;
else
optionRoyalties royaltyRates::OptionRateUpTo netPricePerCopy royaltyRates::OptionThreshold
royaltyRates::OptionRateAbove netPricePerCopy estimatedCopiesSold royaltyRates::OptionThreshold;
Output results
cout fixed;
cout.precision;
cout "Royalties under Option : $ optionRoyalties endl;
cout "Royalties under Option : $ optionRoyalties endl;
cout "Royalties under Option : $ optionRoyalties endl;
Determine the best option
if optionRoyalties optionRoyalties && optionRoyalties optionRoyalties
cout "Option is the best choice." endl;
else if optionRoyalties optionRoyalties && optionRoyalties optionRoyalties
cout "Option is the best choice." endl;
else
cout "Option is the best choice." endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started