Question

C++ Programming In this project, we will be reading in data, performing some calculations and doing...

C++ Programming

In this project, we will be reading in data, performing some calculations and doing formatted output.

Our program will be calculating very simple "taxes" for a user. Start by prompting for the users full name. Then ask them for their gross income. Then prompt them for their deductions. After this, prompt them for the tax rate on their income after deductions. Finally, display how much they owe in taxes in a nicely formatted output. In this output, ensure that the calculations are shown to 2 digits of precision after the decimal point and that the tax rate is displayed to 3 digits of precision after the decimal point.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>

#include<iomanip>

using namespace std;

int main()

{

    string name;

   

    cout<<"Enter your name : ";

    getline(cin, name);

   

    double gross, deductions, tax_rate;

   

    cout<<"\nEnter the gross income : ";

    cin>>gross;

   

    cout<<"\nEnter the deductions : ";

    cin>>deductions;

   

    cout<<"\nEnter the tax rate : ";

    cin>>tax_rate;

   

    // convert tax percentage into fraction

    tax_rate = tax_rate / 100.0;

   

    // calculate total tax

    double tax = (gross - deductions) * tax_rate;

   

    cout<<"name               : "<<name<<endl;

    cout<<"Gross Income       : $";

    cout<<setprecision(2)<<gross<<endl;

    cout<<"Deductions         : $";

    cout<<setprecision(2)<<deductions<<endl;

    cout<<"Total Tax Payable : $";

    cout<<setprecision(3)<<tax<<endl;

   

    return 0;

}

Sample Output

Enter your name Chandler Bing Enter the gross income 10000 nter the deductions 135 Enter the tax rate : 5-6 Chandler Bing $1e

Add a comment
Know the answer?
Add Answer to:
C++ Programming In this project, we will be reading in data, performing some calculations and doing...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA Programming . Description: For an unknown number of employees: prompt and receive payroll data; calculate...

    JAVA Programming . Description: For an unknown number of employees: prompt and receive payroll data; calculate gross pay, taxes owed, and net pay; and display a pay stub. Input : Prompt and receive input from the user for the following:  /// Employee’s First and Last Name  /// Hours Worked  /// Pay Rate  /// Overtime Rate Multiplier ** For the Employee’s First and Last Name:  Both data items must be read in one prompting into one...

  • In this project you will write a C++ program that simulates the purchase of a single...

    In this project you will write a C++ program that simulates the purchase of a single item in an online store. What to do Write a C++ program that: 1. Prints out a welcome message. 2. Prompts the user for the following information: (a) Their first name (example: Roger) (b) Their last name (example: Waters) (c) The name of the product (example: Brick) (d) The unit price of the product (example: 1.99) (e) The quantity to buy (example: 200) (f)...

  • Using C++ Instructions Redo Programming Exercise 18 of Chapter 2 (LOOK BELOW FOR EXERCISE 18), taking...

    Using C++ Instructions Redo Programming Exercise 18 of Chapter 2 (LOOK BELOW FOR EXERCISE 18), taking into account that your parents buy additional savings bonds for you as follows: a. If you do not spend any money to buy savings bonds, then because you had a summer job, your parents buy savings bonds for you in an amount equal to 1% of the money you save after paying taxes and buying clothes, other accessories, and school supplies. b. If you...

  • Can you solve this proble by using C# application? C# is one of programming languages supported...

    Can you solve this proble by using C# application? C# is one of programming languages supported by Visual Studio 2015. It combines the features of Java and C ++ and is suitbale for rapid application development. A retail company must file a monthly sales tax report listing the total sales for the month, and the amount of state and county sales tax collected. The state sales tax rate is 4% and the county sales tax rate is 2%. Create an...

  • Hurry up Please help me : C++ Enter property zip code: 95148 Enter property address: 2613...

    Hurry up Please help me : C++ Enter property zip code: 95148 Enter property address: 2613 Aborn Rd, San Jose CA Enter property offer price (principal): $312500 Enter down payment (in percentage %): 20.0 Enter annual interest rate (in percentage %): 5.75 Enter number of years financing: 15 Mortgage calculator is processing your data ... Please wait...                      **************************************                       MORTGAGE CALCULATOR RESULTS                      ************************************** Property address: 2613 Aborn Rd, San Jose CA 95148 Property offer price:                                       $...

  • I need help with this assignment in C++, please! *** The instructions and programming style detai...

    I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

  • C++ programming For this assignment, write a program that will act as a geometry calculator. The...

    C++ programming For this assignment, write a program that will act as a geometry calculator. The program will be menu-driven and should continue to execute as long as the user wants to continue. Basic Program Logic The program should start by displaying a menu similar to the following: Geometry Calculator 1. Calculate the area of a circle 2. Calculate the area of a triangle 3. Quit Enter your choice(1-3): and get the user's choice as an integer. After the choice...

  • I need help with my coding for C++! The goal of this is to calculate the...

    I need help with my coding for C++! The goal of this is to calculate the total cost of a product by combining the products price and the amount of tax, then display it to the user. The numbers we have to test out is 100 for the price and 8.25 for the percentage. When I test is out, the formula works but it isn't rounding the 108.25 to 108.3, which is the total price we are supposed to display...

  • C++ Programming

    PROGRAM DESCRIPTIONIn this project, you have to write a C++ program to keep track of grades of students using structures and files.You are provided a data file named student.dat. Open the file to view it. Keep a backup of this file all the time since you will be editing this file in the program and may lose the content.The file has multiple rows—each row represents a student. The data items are in order: last name, first name including any middle...

  • A Simple Calculator Summary: Write a console program (character based) to do simple calculations (addition, subtraction,...

    A Simple Calculator Summary: Write a console program (character based) to do simple calculations (addition, subtraction, multiplication and division) of two numbers, using your understanding of Java. Description: You need to write a program that will display a menu when it is run. The menu gives five choices of operation: addition, subtraction, multiplication, division, and a last choice to exit the program. It then prompts the user to make a choice of the calculation they want to do. Once the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT