Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ please. Bottom is sample. Feeling financially frazzled? Like, no matter how hard you try, you just can't make ends meet? What's a budding
In C++ please. Bottom is sample.
Feeling financially frazzled? Like, no matter how hard you try, you just can't make ends meet? What's a budding software developer to do? Write a program to help, of course! You're to write a program that prompts the user for how many hours he/she works in a week, and what their hourly wage is. Armed with those two pieces of information, you'll display some helpful financial figures as to how much he/she is earning per week, per month and per year. But these are just gross amounts, after that you'll display their final annual salary after taxes. If you'd like to see some sample runs of the program, click here . Naturally, there are a few rules you'll need to follow for this assignment, here are the functions you'll have to write: . main: This function will ask the user for the hourly wage and number of hours worked in a week. These values are then to be sent as input to the DispPayEval function, which displays the calculated results to the screen. DispPayEval: This function receives two arguments from the user, representing the hourly pay and the number of hours worked in a week; it returns nothing to the caller. With that information, this function can call the CalcPay function to calculate the weekly, monthly and yearly pay totals. After displaying those gross amounts to the screen, the next thing to display is what the annual salary will be after taxes are deducted (assume a tax rate of 30%). Finally, based on the value of adjusted yearly pay, a summary message about the user's financial health should be displayed: if the user's after-tax salary is less than or equal to $35,000 then you should advise the user to increase their earnings. However if the after-tax salary is more than that threshold but less than or equal to $50,000 you should let them know that they're doing okay. And if the user is earning more than $50,000 display a message about how well he/she is doing financially. CalcPay: This function receives three arguments from the caller -- the hourly wage, the number of hours worked in a week, and a character that indicates whether a weekly, monthly or yearly amount is to be calculated. For example, if the character parameter has a value of lowercase w, that would mean that the function is supposed to return the weekly total back to the caller. On the other hand, if the character parameter instead has a value of lowercase m (for "month"), you should return the monthly total, and if it has a value of lowercase y (for "year"), return the yearly total. So the function can return the calculated pay for one week, one month or one year, depending on what the value of the character parameter is. SetMoney Display: This function takes no input and returns nothing to the caller. All it does is execute those three magic statements that setup the display for monetary amounts. So think carefully about this problem and what each individual function's responsibility is. A structure chart can be very helpful to understand which function calls which function, and what the flow of data among the functions is, so guess what? I drew one for you in ASCII art! Just click here to see the chart 2. Also, study the sample runs and try to imagine where the functions are executing underneath. Here's a vital and important suggestion: don't attempt to write the code for this program until you are certain that you fully understand what each function is going to do, or else you are very likely to waste your time and effort on code that doesn't match the problem description! Save all your code in the HW05 directory in a file called calc_salary.cpp before class meets next time. Enjoy! Here are a few sample runs of the program for the "Financial Analysis" assignment: Run #1 Enter your hourly wage: $25.25 Enter weekly hours: 40.00 Here is your earnings analysis: $1010.00 for one week b) $4040.00 for one month c) $52520.00 for one year After taxes your annual income is $36764.00 Not bad, but there's definitely room for improvement. Run #2 Enter your hourly wage: $55.00 Enter weekly hours: 35.00 Here is your earnings analysis: a) $1925.00 for one week b) $7700.00 for one month c) $100100.00 for one year After taxes your annual income is $70070.00 Congratulations, you're on the road to financial freedom! Run #3 Enter your hourly wage: $12.75 Enter weekly hours: 35.00 Here is your earnings analysis: $446.25 for one week b) $1785.00 for one month c) $23205.00 for one year After taxes your annual income is $16243.50 If possible, increase your earnings ASAP! Feeling financially frazzled? Like, no matter how hard you try, you just can't make ends meet? What's a budding software developer to do? Write a program to help, of course! You're to write a program that prompts the user for how many hours he/she works in a week, and what their hourly wage is. Armed with those two pieces of information, you'll display some helpful financial figures as to how much he/she is earning per week, per month and per year. But these are just gross amounts, after that you'll display their final annual salary after taxes. If you'd like to see some sample runs of the program, click here . Naturally, there are a few rules you'll need to follow for this assignment, here are the functions you'll have to write: . main: This function will ask the user for the hourly wage and number of hours worked in a week. These values are then to be sent as input to the DispPayEval function, which displays the calculated results to the screen. DispPayEval: This function receives two arguments from the user, representing the hourly pay and the number of hours worked in a week; it returns nothing to the caller. With that information, this function can call the CalcPay function to calculate the weekly, monthly and yearly pay totals. After displaying those gross amounts to the screen, the next thing to display is what the annual salary will be after taxes are deducted (assume a tax rate of 30%). Finally, based on the value of adjusted yearly pay, a summary message about the user's financial health should be displayed: if the user's after-tax salary is less than or equal to $35,000 then you should advise the user to increase their earnings. However if the after-tax salary is more than that threshold but less than or equal to $50,000 you should let them know that they're doing okay. And if the user is earning more than $50,000 display a message about how well he/she is doing financially. CalcPay: This function receives three arguments from the caller -- the hourly wage, the number of hours worked in a week, and a character that indicates whether a weekly, monthly or yearly amount is to be calculated. For example, if the character parameter has a value of lowercase w, that would mean that the function is supposed to return the weekly total back to the caller. On the other hand, if the character parameter instead has a value of lowercase m (for "month"), you should return the monthly total, and if it has a value of lowercase y (for "year"), return the yearly total. So the function can return the calculated pay for one week, one month or one year, depending on what the value of the character parameter is. SetMoney Display: This function takes no input and returns nothing to the caller. All it does is execute those three magic statements that setup the display for monetary amounts. So think carefully about this problem and what each individual function's responsibility is. A structure chart can be very helpful to understand which function calls which function, and what the flow of data among the functions is, so guess what? I drew one for you in ASCII art! Just click here to see the chart 2. Also, study the sample runs and try to imagine where the functions are executing underneath. Here's a vital and important suggestion: don't attempt to write the code for this program until you are certain that you fully understand what each function is going to do, or else you are very likely to waste your time and effort on code that doesn't match the problem description! Save all your code in the HW05 directory in a file called calc_salary.cpp before class meets next time. Enjoy! Here are a few sample runs of the program for the "Financial Analysis" assignment: Run #1 Enter your hourly wage: $25.25 Enter weekly hours: 40.00 Here is your earnings analysis: $1010.00 for one week b) $4040.00 for one month c) $52520.00 for one year After taxes your annual income is $36764.00 Not bad, but there's definitely room for improvement. Run #2 Enter your hourly wage: $55.00 Enter weekly hours: 35.00 Here is your earnings analysis: a) $1925.00 for one week b) $7700.00 for one month c) $100100.00 for one year After taxes your annual income is $70070.00 Congratulations, you're on the road to financial freedom! Run #3 Enter your hourly wage: $12.75 Enter weekly hours: 35.00 Here is your earnings analysis: $446.25 for one week b) $1785.00 for one month c) $23205.00 for one year After taxes your annual income is $16243.50 If possible, increase your earnings ASAPStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started