Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions Redo Programming Exercise 1 6 of Chapter 4 so that all the named constants are defined in a namespace royaltyRates. Instructions for Programming Exercise
Instructions 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.
this is the code i have so far:
#include
#include
#include
namespace royaltyRates
const double OPTIONDELIVERYPAYMENT ;
const double OPTIONPUBLICATIONPAYMENT ;
const double OPTIONROYALTYRATE ;
const double OPTIONBASEROYALTYRATE ;
const double OPTIONADDITIONALROYALTYRATE ;
const int OPTIONTHRESHOLD ;
double calculateOptionRoyalties
return royaltyRates::OPTIONDELIVERYPAYMENT royaltyRates::OPTIONPUBLICATIONPAYMENT;
double calculateOptionRoyaltiesdouble netPrice, int copiesSold
return netPrice copiesSold royaltyRates::OPTIONROYALTYRATE;
double calculateOptionRoyaltiesdouble netPrice, int copiesSold
double baseRoyalties netPrice std::mincopiesSold royaltyRates::OPTIONTHRESHOLD royaltyRates::OPTIONBASEROYALTYRATE;
double additionalRoyalties ;
if copiesSold royaltyRates::OPTIONTHRESHOLD
additionalRoyalties netPrice copiesSold royaltyRates::OPTIONTHRESHOLD royaltyRates::OPTIONADDITIONALROYALTYRATE;
return baseRoyalties additionalRoyalties;
int main
double netPrice;
int copiesSold;
std::cout "Enter the net price of each copy of the novel: ;
std::cin netPrice;
std::cout "Enter the estimated number of copies that will be sold: ;
std::cin copiesSold;
double optionRoyalties calculateOptionRoyalties;
double optionRoyalties calculateOptionRoyaltiesnetPrice copiesSold;
double optionRoyalties calculateOptionRoyaltiesnetPrice copiesSold;
std::cout std::fixed std::setprecision;
std::cout "Royalty option: optionRoyalties std::endl;
std::cout "Royalty option: optionRoyalties std::endl;
std::cout "Royalty option: optionRoyalties std::endl;
double maxRoyalties std::maxoptionRoyalties, optionRoyalties, optionRoyalties;
if maxRoyalties optionRoyalties
std::cout "The best option is Option std::endl;
else if maxRoyalties optionRoyalties
std::cout "The best option is Option std::endl;
else
std::cout "The best option is Option std::endl;
return ;
and this is the error code that i cant figure out how to get around. the first and third tasks pass, just not number
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: Royalty option:
Royalty option:
Royalty option:
The best option is Option
Error : AssertionError Unable to find Royalty option: in the program's output.
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