Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Help program something like this? Write a program that helps the user -- pro

ID: 3860491 • Letter: C

Question

C++ Help program something like this?

Write a program that helps the user -- prospectively a manager at the company -- determine the budget for the next year. You should gather from them both the budgetted amount for last year and the amount spent for last year. For each, the user mayenter the currency units either in front orin back of the value. If they enter neither, you are to assume that currency is measured in dollars ($). If they enter something in both places, you'll have to ask them -- or perhaps be terribly clever -- to decide which thing is the currency unit.

Then calculate for them the percent of their budget that was used -- this may be over 100%. This percent should be roundedto the nearestwhole percent. Finally, force their spending upto the nearest$100and tell them that this figure will be their budget for the next year.

Make sure you print their results in a nice way. Use the currency unit they entered at the beginning (or $). Be sure to place this marker either in front or in back of the new budget just like they entered it. (If they didn't enter the units, place the $in the front by default.) And always print two decimal places (even though we shouldn't have any change to report). Also print the percent of their budget that was used with a percent sign (%) after it.

printing the opening message

printing the closing message

printing a monetary amount with proper formatting

printing all of the results

rounding a value to the nearest desired 'place'

rounding a value to the next highest desired 'place'

calculating what decimal percent one value is of another

calculating the projected budget (uses 'next highest' function)

Explanation / Answer

#include<bits/stdc++.h>

using namespace std;

void openingMessage()

{

cout<<" Welcome to the Budget Projection Program!!! ";

}

void closingMessage()

{

cout<<"Thank you for using the BPP Endeavor to have fiscally fit day! ";

}

void Input(int &amt,int &spend)

{

cout<<"What was your budget allotment last year? $";

cin>>amt;

cout<<"Fine,and how much did you spend last year? $";

cin>>spend;

}

int percentage(int amt,int spend)

{

return (spend/amt)*100;

}

int roundOff(int &per)

{

if(per>100)

per=100;

return per;

}

int roundTo100(int n)

{

n=(n + 50) / 100 * 100;

n=n+100;

return n;

}

void NextBudget(int spend,int amt)

{int budget;

if(spend>amt)

{

budget=spend;

}

else

{

budget=amt;

}

budget=roundTo100(budget);

cout<<"Your budget next year will be $"<<budget<<endl;

}

void Calculate(int amt,int spend)

{

cout<<"Thank you!!! Calculating... Done $ ";

int per=percentage(amt,spend);

cout<<"percentage is akshay"<<per<<endl;

per=roundOff(per);

cout<<"Last year you used about "<<per<<" % of your budget. ";

NextBudget(spend,amt);

}

int main(int argc, char const *argv[])

{

int amt,spend;

openingMessage();

Input(amt,spend);

Calculate(amt,spend);

closingMessage();

return 0;

}

===================================

Output:

Welcome to the Budget Projection Program!!!
What was your budget allotment last year? $1300
Fine,and how much did you spend last year? $1432
Thank you!!! Calculating... Done $
percentage is akshay100
Last year you used about 100 % of your budget.
Your budget next year will be $1500
Thank you for using the BPP
Endeavor to have fiscally fit day!