Question: Write a program which will ask the user initially for their total income, which will be a whole dollar amount followed by the number of

Write a program which will ask the user initially for their total income, which will be a whole dollar amount followed by the number of children that they have and the program will output the amount of tax that the user will be required to pay.

If the user enters a negative income value, ask the user to re-enter their income. The same is true if the user enters a non-numeric value.

An income of $0 is okay.

If the user enters a negative or non-numeric number of children, ask the user to re-enter their number of children.

If the amount of tax payable is a negative amount or zero, then output "You owe no tax."

For this exercise, you may assume that the user will only input an incorrect value for each input once. You will not need to use while loops to complete this exercise.

RULES:

There will be a single income tax rate of 2% for everyone. Each taxpayer will receive a deduction of $10,000 regardless of their income amount in order to remove the need to keep receipts of various tax deductible expenditures. For each dependent child there will be a deduction of $2000.

A taxpayers income is reduced by the total amount of their deductions before the amount of tax payable is calculated.

EXAMPLE SCREENSHOTS:

Write a program which will ask the user initially for their total

income, which will be a whole dollar amount followed by the number

of children that they have and the program will output the amount

of tax that the user will be required to pay. If the

It is important that you display the exact same messages as in the example. If your program displays something else you may fail the exercise even if your program does the conversion correctly. In particular, for this program it is vital that "You owe no tax." (with the full stop) is displayed if no tax is owed, and that the amount of tax is displayed otherwise.

CODE:

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace IncomeTaxCalculator { class IncomeTaxV2 { public static void Main() { // You aren't provided with any example code for this exercise // Your task is to write this program from scratch by extending your previous exercise Console.WriteLine(" Hit Enter to exit."); Console.ReadLine(); } } }

What is your total income: -88 Your income cannot be negative. What is your total income: 40000 How many children do you have: -2 You must enter a positive number. How many childen do you have: e You owe a total of $600.00 tax Hit Enter to exit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!