Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have passed two of the three trials pls help pass the last one ASAP - Status: PASSED! Check: 1 Test: Successful Output Reason: None
I have passed two of the three trials pls help pass the last one ASAP
Status: PASSED!
Check:
Test: Successful Output
Reason: None
Timestamp:
:
:
Status: FAILED!
Check:
Test: Successful Output II
Reason: Unable to find
Royalty option
:
Royalty option
:
Royalty option
:
in the program's output.
Please enter the net price per copy: Please also enter the estimated amount of copies that will sell: Royalty option
:
Royalty option
:
Royalty option
:
The best option for you is Option
Error : AssertionError
Unable to find Royalty option
:
in the program's output.
Timestamp:
:
:
Status: PASSED!
Check:
Test: Check for constant declaration in
namespace
Reason: namespace royaltyRates
was found in the program.None
Timestamp:
:
:
and here is my code
#include
#include
using namespace std;
namespace royaltyRates
const double OPTION
FIXED
ROYALTY
;
const double OPTION
ROYALTY
RATE
;
const double OPTION
FIRST
RATE
;
const double OPTION
OVER
RATE
;
void calculateRoyalties
double netPricePerCopy;
int estimatedCopiesSold;
cout
fixed
setprecision
;
Input net price per copy and estimated copies sold
cout
Please enter the net price per copy:
;
cin
netPricePerCopy;
if
netPricePerCopy
cout
Invalid input for net price per copy. It must be non
negative.
;
return;
cout
Please also enter the estimated amount of copies that will sell:
;
cin
estimatedCopiesSold;
if
estimatedCopiesSold
cout
Invalid input for estimated copies sold. It must be non
negative.
;
return;
double option
Royalty
OPTION
FIXED
ROYALTY;
double option
Royalty
netPricePerCopy
estimatedCopiesSold
OPTION
ROYALTY
RATE;
double option
Royalty;
if
estimatedCopiesSold
option
Royalty
netPricePerCopy
estimatedCopiesSold
OPTION
FIRST
RATE;
else
option
Royalty
netPricePerCopy
OPTION
FIRST
RATE
estimatedCopiesSold
netPricePerCopy
OPTION
OVER
RATE
;
Output royalties for each option
cout
Royalty option
:
option
Royalty
endl;
cout
Royalty option
:
option
Royalty
endl;
cout
Royalty option
:
option
Royalty
endl;
Determine the best option
if
option
Royalty
option
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