Answer to Question #183016 in C++ for Vincenzo Santoro

Question #183016

Exercise 16

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 $5,000 upon delivery of the final manuscript and $20,000 when the novel is published. In the second option, the author is paid 12.5% of the net price of the novel for each copy of the novel sold. In the third option, the author is paid 10% of the net price for the first 4,000 copies sold, and 14% of the net price for the copies sold over 4,000. 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.)


1
Expert's answer
2021-04-28T16:47:52-0400
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
const int a1 = 5000;
const int a2 = 20000;

const float b1 = 0.125;

const float c1 = 0.1;
const float c2 = 0.14;
const int c3 = 4000;

int price,number;
float a,b,c,d;

cout <<"Please, enter the price of the novel: ";
cin >> price;
cout <<"Enter estimated number of copies: ";
cin >> number;

a=a1+a2;
b=b1*price*number;
if (number<=4000) {c=c1*price*number;} else {c=c1*price*4000+c2*price*(number-4000);} 

cout <<"First option: " << a<< endl;;
cout <<"Second option: " << b<< endl;;
cout <<"Third  option: " << c<< endl;;
d=max(a,b);
cout <<"The best option: " << max(d,c);

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS