Question

In: Computer Science

Your task is to write a program in C or C++ that calculates the total amount...

Your task is to write a program in C or C++ that calculates the total amount of money a person has made over the last year. Your program will prompt the user for dollar amounts showing how much the user has made per job. Some users will have had more than one job, make sure your program allows for this. The program will print out the total made (all jobs) and will print out the federal and state taxes based on the total made. For this program, the federal tax will be 8.5% and the state tax will be 14.5%.

1)Use appropriate comments through out the program.

2)Create a header at the top showing the programmer, date of creation and class

3)Print out the source code, and 3 sample runs.

4)Make sure you insert appropriate instructions for the user.

Notes:

1)No negatives are allowed (negative income), check for this.

2)You may use any loop type you wish - be able to defend your choice.

Deliverables:

1)The source code of your completed, working program

2)3 sample runs of your program

Solutions

Expert Solution

Here is the answer for your question in C++ Programming Language.

Kindly upvote if you find the answer helpful.

##########################################################################

CODE :

/*
   Programmer : John Doe
   Date : 15/10/2020
   Class : ABC
*/
#include<iostream>

using namespace std;

int main(){
   //Required variables and constants
   char choice = 'y';
   int noOfJobs,i=0;
   double earnings,totalEarned = 0,netIncome;
   const double salesTax = 0.085,stateTax = 0.145;
  
   //Greetings to the user
   cout << "====================================" << endl;
   cout << "\tINCOME CALCULATION" << endl;
   cout << "====================================" << endl;
  
   //Read jobs and their income of previous year as longs as user has additional jobs
   while(choice != 'n' && choice != 'N'){                  
       //Read job earnings of ih job
       cout << "Enter Job # " << (i+1) << "'s total income for the year : $";
       cin >> earnings;
       //Validate whether earnings are negative value
       while(earnings < 0 ){
           cout << "Income cannot be negative..Try again" << endl;
           cout << "Enter Job # " << (i+1) << "'s total income for the year : $";
           cin >> earnings;              
       }          
       //Sum up earnings
       totalEarned += earnings;  
       //Increment i value by 1
       i++;
       //Ask whether user had additional job
       cout << endl << "Did you work for additional job in the same year[Y/N]?";
       cin >> choice;
       cout << endl;
   }
   //Calculate net income
   netIncome = totalEarned - ((totalEarned*salesTax) + (totalEarned*stateTax));
  
   //Display total income,taxes and net income
   cout << endl << "================================================" << endl;
   cout << "\tEARNINGS OF PREVIOUS YEAR" << endl;
   cout << "================================================" << endl;
   cout << "Total Income : $" << totalEarned << endl;
   cout << "Sales Tax Amount deducted: $" << (totalEarned*salesTax) << endl;
   cout << "State Tax Amount deducted: $" << (totalEarned*stateTax) << endl;
   cout << "Net Income : $" << netIncome << endl;
   cout << "================================================" << endl;
  
   return 0;
}

#######################################################################

SCREENSHOTS :

Please see the screenshots of the code below for the indentations of the code.

#######################################################

OUTPUT :

Any doubts regarding this can be explained with pleasure :)


Related Solutions

Please use Phyton to write a program: Write a program that calculates and displays the total...
Please use Phyton to write a program: Write a program that calculates and displays the total bill at a restaurant for a couple that is dining. The program should collect from the couple, cost of each meal, and the percentage of the final cost that they would like to tip. The sales tax in the state where the restaurant exists is 7.5%. Display to the user, line by line: Total Cost of Both Meals Sales Tax in dollars Tip in...
In the space provided below write a C ++ program that computes the total amount of...
In the space provided below write a C ++ program that computes the total amount of money you are depositing in your bank account. Your program does this by asking you to first enter the number and amount of each check you are depositing, and then it asks you to enter the type of cash bills being deposited and how many of each type, also the types of coins being deposited, and the number of each coin type.
Write a C++ program that calculates mileage reimbursement for a salesperson at a rate of $...
Write a C++ program that calculates mileage reimbursement for a salesperson at a rate of $ 0.35 per mile. Your program should interact with the user in this manner: MILEAGE REIMBURSEMENT CALCULATOR Enter beginning odometer reading: 13505.2 Enter ending odometer reading     : 13810.6 You traveled 305.40 miles. At $ 0.35 per mile, your reimbursement is $ 106.89. The values in red color are inputs for the program. The values in blue color are results of expressions.
In the space provided below write a C program that computes the total amount of money...
In the space provided below write a C program that computes the total amount of money you have stored in your piggy bank. Your program does this by asking you for number of pennies, nickels, dimes, and quarters in the piggy bank and then displays how much money in total is in the piggy bank.
Write a C program that calculates a student grade in the C Programming Class. Ask the...
Write a C program that calculates a student grade in the C Programming Class. Ask the user to enter the grades for each one of the assignments completed in class: Quiz #1 - 25 points Quiz #2 - 50 points Quiz #3 - 30 points Project #1 - 100 points Project #2 - 100 points Final Test - 100 points The total of the quizzes count for a 30% of the total grade, the total of the projects counts for...
make a c++ program that calculates the amount left from a value of money of one...
make a c++ program that calculates the amount left from a value of money of one dollar bill or less in quarters, dimes, nickels, and pennies. The remaining value can be shown in cents knowing that in cents: penny = 1 nickel = 5 dime = 10 quarter = 25
Write a program that calculates the amount a person would earn over a period of time...
Write a program that calculates the amount a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should display a table showing the salary for each day, and then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the number of pennies. Input Validation: Do not...
In C++, Write a program that calculates pay for either an hourly paid worker or a...
In C++, Write a program that calculates pay for either an hourly paid worker or a salaried worker. Hourly paid workers are paid their hourly pay rate times the number of hours worked. Salaried workers are paid their regular salary plus any bonus they may have earned. The program should declare two structures for the following data: Hourly Paid: HoursWorked HourlyRate Salaried: Salary Bonus The program should also declare a union with two members. Each member should be a structure...
C++ 19.32 LAB: Exact change - functions Write a program with total change amount as an...
C++ 19.32 LAB: Exact change - functions Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2...
USING C++ PLEASE Write a program named Lab11C that calculates the average of a group of...
USING C++ PLEASE Write a program named Lab11C that calculates the average of a group of test scores where the lowest score is dropped. It should use the following functions a) void getScores should have 4 double reference parameters (one for each test score) getScores should do the following: - read 4 test scores from the text file Lab11C.txt (Important: declare your ifstream infile and open the file inside this function, not in the main function) - store them in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT