Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How can I modify my program to return the option with the highest amount ? //A new author is in the process of negotiating a

How can I modify my program to return the option with the highest amount ?

//A new author is in the process of negotiating a contract for a new romance novel.

//The publisher is offering three options.

//1. The author is paid $5,000 upon delivery of the final manuscript and $20,000 when the novel is published.

//2. In the second option, the author is paid 12.5% of the net price of the novel for each copy of the novel sold.

//3.In the third option, the author is paid 10% of the net price for the first 4000 copies sold, and 14% of the net price for the copies sold over 4000.

//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 royalties rates and fixed royalties.)

#include

#include

using namespace std;

class author {

public:

void getData();

void printData();

int option_1();

int option_2();

int option_3();

private:

bool isFound = false;

double netprice;

int copies;

int option;

};

int main () {

author Twain;

Twain.getData();

Twain.printData();

return 0;

}

void author::getData() {

cout << "Enter the net price of each copy of the novel: ";

cin >> netprice;

cin.ignore(100, ' ');

cout << "Enter the number of copies that will be sold: ";

cin >> copies;

cout << endl; }

int author::option_1() {

return 5000 + 20000; }

int author::option_2() {

return (netprice + (netprice*.125)) * copies ; }

int author::option_3() {

if (copies < 4000)

return (netprice + (netprice*.10)) * copies;

else

return ((netprice + (netprice*.10)) * copies) + ((netprice + (netprice*.14)) * copies); }

void author::printData() {

cout << left << setw(20) << "Net Price: " << netprice << endl;

cout << left << setw(20) << "Copies: " << copies << endl;

cout << left << setw(30) << " Amount for each option: " << endl;

cout << left << setw(20) << "Option 1: " << option_1() << endl;

cout << left << setw(20) << "Option 2: " << option_2() << endl;

cout << left << setw(20) << "Option 3: " << option_3() << endl; }

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_2

Step: 3

blur-text-image_3

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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

How does competition among investors lead to efficient markets?

Answered: 1 week ago