Answered step by step
Verified Expert Solution
Link Copied!

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:
1
Test: Successful Output
Reason: None
Timestamp:
2
0
2
4
-
0
7
-
0
5
1
8
:
0
7
:
5
4
.
9
0
2
4
0
8
Status: FAILED!
Check:
2
Test: Successful Output II
Reason: Unable to find
'
[
'
Royalty option
1
:
2
5
0
0
0
.
0
0
'
,
'Royalty option
2
:
7
7
1
6
0
4
9
3
1
.
2
5
'
,
'Royalty option
3
:
8
6
4
1
8
9
5
2
3
.
0
0
'
]
'
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
1
:
2
5
0
0
0
.
0
0
Royalty option
2
:
7
7
1
6
0
4
9
3
1
.
2
5
Royalty option
3
:
6
1
7
2
8
3
9
4
5
.
0
0
The best option for you is Option
2
.
.
Error : AssertionError
-
Unable to find Royalty option
3
:
8
6
4
1
8
9
5
2
3
.
0
0
in the program's output.
Timestamp:
2
0
2
4
-
0
7
-
0
5
1
8
:
0
7
:
5
4
.
9
0
4
6
2
5
Status: PASSED!
Check:
3
Test: Check for constant declaration in
`
namespace
`
Reason: namespace royaltyRates
+
`
was found in the program.None
Timestamp:
2
0
2
4
-
0
7
-
0
5
1
8
:
0
7
:
5
4
.
9
0
5
0
1
8
and here is my code
-
#include
#include
using namespace std;
namespace royaltyRates
{
const double OPTION
1
_
FIXED
_
ROYALTY
=
2
5
0
0
0
.
0
;
const double OPTION
2
_
ROYALTY
_
RATE
=
0
.
1
2
5
;
const double OPTION
3
_
FIRST
_
4
0
0
0
_
RATE
=
0
.
1
0
;
const double OPTION
3
_
OVER
_
4
0
0
0
_
RATE
=
0
.
1
4
;
void calculateRoyalties
(
)
{
double netPricePerCopy;
int estimatedCopiesSold;
cout
<
<
fixed
<
<
setprecision
(
2
)
;
/
/
Input net price per copy and estimated copies sold
cout
<
<
"Please enter the net price per copy:
"
;
cin
>
>
netPricePerCopy;
if
(
netPricePerCopy
<
0
)
{
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
<
0
)
{
cout
<
<
"Invalid input for estimated copies sold. It must be non
-
negative.
"
;
return;
}
double option
1
Royalty
=
OPTION
1
_
FIXED
_
ROYALTY;
double option
2
Royalty
=
netPricePerCopy
*
estimatedCopiesSold
*
OPTION
2
_
ROYALTY
_
RATE;
double option
3
Royalty;
if
(
estimatedCopiesSold
<
=
4
0
0
0
)
{
option
3
Royalty
=
netPricePerCopy
*
estimatedCopiesSold
*
OPTION
3
_
FIRST
_
4
0
0
0
_
RATE;
}
else
{
option
3
Royalty
=
(
4
0
0
0
*
netPricePerCopy
*
OPTION
3
_
FIRST
_
4
0
0
0
_
RATE
)
+
(
(
estimatedCopiesSold
-
4
0
0
0
)
*
netPricePerCopy
*
OPTION
3
_
OVER
_
4
0
0
0
_
RATE
)
;
}
/
/
Output royalties for each option
cout
<
<
"Royalty option
1
:
"
<
<
option
1
Royalty
<
<
endl;
cout
<
<
"Royalty option
2
:
"
<
<
option
2
Royalty
<
<
endl;
cout
<
<
"Royalty option
3
:
"
<
<
option
3
Royalty
<
<
endl;
/
/
Determine the best option
if
(
option
1
Royalty
>
option
2

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

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

=+a) What is the center line for the R chart?

Answered: 1 week ago

Question

Do you believe that Matilda overreacted to James? Why or why not?

Answered: 1 week ago