Add While loop statement to program

17. 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 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.)
*/

I have to add while loops to these statements how can I do that..Please help!!



#include<iostream>
#include<iomanip>
//#include<fstream>
using namespace std;

int main()
{
//ifstream infile;
//ofstream cout;

//infile.open("input_num_info.txt");
//cout.open("cout_info.txt");

const double opt_2 = 0.125; // 12.5%
const double opt_3 = 0.10; // 10%
const double opt_3_1 = 0.14; // 14%

cout << fixed << showpoint << setprecision(2);



double pay,novel_pubAmount,price_Sold_over,n_price,e_number,royalties,option1_Total_Pay,nSold,npp,alltogethger,x,numbers;


pay = 5000;
novel_pubAmount = 20000;
price_Sold_over = 4000;
option1_Total_Pay = pay + novel_pubAmount;

//cin >>numbers;
//cout<<numbers<<endl;


cout << "Author please enter the Net Price of each novel: " << endl;
cin >> n_price;

cout << " Please enter the estimated number of copies that maybe sold : " << endl;
cin >> e_number;
cout <<endl<<endl;

cout <<"OPTION 1:" << endl;
cout << "The author is paid" <<" "<< pay << endl;
cout<<"upon delivery of the final manuscript. "<<endl;;
cout << "When the novel is published you will get an extra: " <<""<< novel_pubAmount << endl;
cout << "Totals :" << option1_Total_Pay <<endl<<endl<<endl;



cout <<"OPTION 2:" << endl;
cout<<" The author is paid 12.5% net price for each copy of the novel sold" <<endl;
nSold = e_number*opt_2;
cout <<"Totals: " << nSold <<endl << endl;


cout <<"OPTION 3:" << endl;
cout <<"The will be paid 10% of the net price for the first 4000 copies sold"<<endl;
nSold = e_number*opt_3;
cout <<"Totals: " << nSold <<endl << endl;

//if (e_number >price_Sold_over)
// np = e_number*opt_3;
/////////cout <<"The will be paid 10% of the net price for the first 4000 copies sold"<<endl;

//cout<<"Totals: "<< np<< endl;




if (e_number >price_Sold_over)
cout<<" Additional %14 the net price for the copies sold over 4000.: "<<endl;
x = e_number*opt_3_1;
cout<<"Totals: "<< x << endl;



if (e_number <price_Sold_over)
cout<<" The %14 is not added " << endl;

if (e_number <price_Sold_over)
cout << "Author does not get 10% " << endl;


//cin.close();
//cout.close();


system("Pause");

return 0;

}


output:

Author please enter the Net Price of each novel:
35.29
Please enter the estimated number of copies that maybe sold :
4360


OPTION 1:
The author is paid 5000.00
upon delivery of the final manuscript.
When the novel is published you will get an extra: 20000.00
Totals :25000.00


OPTION 2:
The author is paid 12.5% net price for each copy of the novel sold
Totals: 545.00

OPTION 3:
The will be paid 10% of the net price for the first 4000 copies sold
Totals: 436.00

Additional %14 the net price for the copies sold over 4000.:
Totals: 610.40
Press any key to continue . . .


Topic archived. No new replies allowed.