21.1k views
3 votes
Write a program that projects sales goals for a salesperson for the next several years.The user should be prompted for a first year’s merchandise sales amount and a number of years to project the goals. For the first year, the salesperson’s goal is the current sales amount. After that, sales are projected to grow at a rate of 8 percent per year. You should use a do-while loop.

User Parvaneh
by
5.1k points

1 Answer

3 votes

Answer:

// program in C++.

#include <iostream>

using namespace std;

// main function

int main() {

// variables

int y, count=1;

double s_amt;

// interest rate

const double rate = 0.08 ;

// ask to enter first year amount

cout << "Enter the first year's sale amount: ";

// read amount

cin >> s_amt;

// ask to enter years

cout << "Enter the number of years to project the goals: ";

// read years

cin >> y;

// find goal amount of each years

do{

// print year and goal for that year

cout <<"Goal for year "<<count<<" is "<<s_amt<<endl;

// increase the count

count +=1;

// find new Goal amount

s_amt += s_amt*rate;

} while(count <= y);

return 0;

}

Step-by-step explanation:

Read the first years sale amount from user and assign it to variable "s_amt". Read the years from user and assign it to variable "y".Initialize interest rate "i=0.08".Then with the help of do while loop find goal amount of each year.

Output:

Enter the first year's sale amount: 25000

Enter the number of years to project the goals: 4

Goal for year 1 is 25000

Goal for year 2 is 27000

Goal for year 3 is 29160

Goal for year 4 is 31492.8

User Vadim M
by
5.2k points