Question

In: Computer Science

Need this in C# and also the Pseudocode. Program 4: In 1789, Benjamin Franklin is known...

Need this in C# and also the Pseudocode.

Program 4: In 1789, Benjamin Franklin is known to have written “Our new Constitution is now established, and has an appearance that promises permanency; but in this world nothing can be said to be certain, except death and taxes.” Our federal tax system is a “graduated” tax system which is broken into seven segments. Essentially, the more you make, the higher your tax rate. For 2018, you can find the tax brackets here. Your task is to design (pseudocode) and implement (source code) a program that asks the user for a salary and calculates the federal tax owed. Note, that only the money above a particular tax bracket gets taxed at the higher rate. For example, if someone makes $10,000 a year, the first $9525 gets taxed at 10%. The “excess” above that ($475) gets taxed at 12%. Note: work through at least three (3) examples of this by hand before designing the code. It will save you significant time.  

Sample run 1:

Enter your salary to the nearest dollar: 2000

Total tax owed is: $200

Sample run 2:

Enter your salary to the nearest dollar: 40000

Total tax owed is: $4739

Sample run 3:

Enter your salary to the nearest dollar: 100000

Total tax owed is: $18289

Solutions

Expert Solution

Pseudocode

  • OUTPUT "Enter your salary to the nearest dollar: "
  • INPUT read 'salary' from user
  • SET tax=0
  • IF salary <= 9525
             tax = salary * .1
    ELSE IF salary > 9525 and salary<=38700
           tax = 9525 * .1+(salary-9525)*.12
    ELSE IF salary > 38700 and salary <= 82500
             tax = 9525 * .1 + (38700-9526) * .12+(salary- 38701)*.22
    ELSE IF salary > 82500 and salary <= 157500
              tax = 9525 * .1 + (38700 - 9526) * .12 +(82500-38701)*.22+ (salary - 82501) * .24
    ELSE IF salary > 157500 and salary <= 200000
        tax = 9525 * .1 + (38700 - 9526) * .12 + (82500 - 38701) * .22+(157500- 82501)*.24 + (salary - 157501) * .32
    ELSE IF salary > 20000 and salary <= 500000
             tax = 9525 * .1 + (38700 - 9526) * .12 + (82500 - 38701) * .22 + (157500 - 82501) * .24       +(200000-157501)*.32+ (salary - 200001) * .35
       ELSE
               tax = 9525 * .1 + (38700 - 9526) * .12 + (82500 - 38701) * .22 + (157500 - 82501) * .24 + (200000 - 157501) * .32 +(500000-200001)*.35+ (salary - 500001) * .37;
  • OUTPUT "Total tax owed is: $" + tax

---------------------------------------------------------------------------------------------------------------------------------------------

Screenshot

Program

using System;
namespace FederalTaxCalculatorInCsharp
{
    class Program
    {
        static void Main(string[] args)
        {
            //Prompt for salary
            Console.Write("Enter your salary to the nearest dollar: ");
            int salary= Convert.ToInt32(Console.ReadLine());
            //Variable for tax
            double tax = 0;
            //Each conditons for tax calculaton
            if (salary <= 9525)
            {
                tax = salary * .1;
            }
            else if (salary > 9525 && salary<=38700)
            {
                tax = 9525 * .1+(salary-9525)*.12;
            }
            else if (salary > 38700 && salary <= 82500)
            {
                tax = 9525 * .1 + (38700-9526) * .12+(salary- 38701)*.22;
            }
            else if (salary > 82500 && salary <= 157500)
            {
                tax = 9525 * .1 + (38700 - 9526) * .12 +(82500-38701)*.22+ (salary - 82501) * .24;
            }
            else if (salary > 157500 && salary <= 200000)
            {
                tax = 9525 * .1 + (38700 - 9526) * .12 + (82500 - 38701) * .22+(157500- 82501)*.24 + (salary - 157501) * .32;
            }
            else if (salary > 20000 && salary <= 500000)
            {
                tax = 9525 * .1 + (38700 - 9526) * .12 + (82500 - 38701) * .22 + (157500 - 82501) * .24 +(200000-157501)*.32+ (salary - 200001) * .35;
            }
            else
            {
                tax = 9525 * .1 + (38700 - 9526) * .12 + (82500 - 38701) * .22 + (157500 - 82501) * .24 + (200000 - 157501) * .32 +(500000-200001)*.35+ (salary - 500001) * .37;
            }
            //Display Tax
            Console.WriteLine("Total tax owed is: $" + Convert.ToInt32(tax));
        }
    }
}

-------------------------------------------------------------------------------------------------

Output

Enter your salary to the nearest dollar: 100000
Total tax owed is: $18289


Related Solutions

PLEASE DO THIS IN C#.In 1789, Benjamin Franklin is known to have written “Our new Constitution...
PLEASE DO THIS IN C#.In 1789, Benjamin Franklin is known to have written “Our new Constitution is now established, and has an appearance that promises permanency; but in this world nothing can be said to be certain, except death and taxes.” Our federal tax system is a “graduated” tax system which is broken into seven segments. Essentially, the more you make, the higher your tax rate. For 2018, you can find the tax brackets here. Your task is to design...
I need assistance on this problem in Pseudocode and in C++ Program Program 3: Give a...
I need assistance on this problem in Pseudocode and in C++ Program Program 3: Give a baby $5,000! Did you know that, over the last century, the stock market has returned an average of 10%? You may not care, but you’d better pay attention to this one. If you were to give a newborn baby $5000, put that money in the stock market and NOT add any additional money per year, that money would grow to over $2.9 million by...
I need assistance on this problem in Pseudocode and in C++ Program 1: Stay on the...
I need assistance on this problem in Pseudocode and in C++ Program 1: Stay on the Screen! Animation in video games is just like animation in movies – it’s drawn image by image (called “frames”). Before the game can draw a frame, it needs to update the position of the objects based on their velocities (among other things). To do that is relatively simple: add the velocity to the position of the object each frame. For this program, imagine we...
Hello, I need some assistance on completing this program in Pseudocode and in C++ Program 2:...
Hello, I need some assistance on completing this program in Pseudocode and in C++ Program 2: Buh-RING IT! For this assignment, you’re going to simulate a text-based Role-Playing Game (RPG). Design (pseudocode) and implement (source) for a program that reads in 1) the hero’s Hit Points (HP – or health), 2) the maximum damage the hero does per attack, 3) the monster’s HP and 4) the maximum monster’s damage per attack. When the player attacks, it will pick a random...
C. In 1790 Benjamin Franklin left the equivalent of $4,600 (actually 1,000 British pounds) each to...
C. In 1790 Benjamin Franklin left the equivalent of $4,600 (actually 1,000 British pounds) each to the cities of Philadelphia and Boston. He stipulated that the money be invested and that the principal not be touched for 100 years. If the money had been invested at 4%, compounded yearly, how much would each city have had in 1890?  _____________________ How much if it had been invested at 5%, compounded yearly? __________________ D. A genie popped out of a bottle and offered...
write pseudocode for the following problems not c code Pseudocode only Write a C program to...
write pseudocode for the following problems not c code Pseudocode only Write a C program to print all natural numbers from 1 to n. - using while loop Write a C program to print all natural numbers in reverse (from n to 1). - using while loop Write a C program to print all alphabets from a to z. - using while loop Write a C program to print all even numbers between 1 to 100. - using while loop...
C Program and pseudocode for this problem. Write a C program that plays the game of...
C Program and pseudocode for this problem. Write a C program that plays the game of "Guess the number" as the following: Your program choose the number to be guessed by selecting an integer at random in the rang of 1 to 1000. The program then asks the use to guess the number. If the player's guess is incorrect, your program should loop until the player finally gets the number right. Your program keeps telling the player "Too High" or...
i need a pseudocode for a program in java that will convert dollars into euros and...
i need a pseudocode for a program in java that will convert dollars into euros and japanese yen using the print and prinln methods an if, if -else, statement a switch statement a while statement utilizes the file class uses the random class and random number generator and uses at least three methods other than main
write pseudocode not c program If- else programming exercises 1.    Write a C program to find...
write pseudocode not c program If- else programming exercises 1.    Write a C program to find maximum between two numbers. 2.    Write a C program to find maximum between three numbers. 3.    Write a C program to check whether a number is negative, positive or zero. 4.    Write a C program to check whether a number is divisible by 5 and 11 or not. 5.    Write a C program to check whether a number is even or odd. 6.    Write...
*Need in C language also need full documentation/explanation of each line* Thank you! Write a program...
*Need in C language also need full documentation/explanation of each line* Thank you! Write a program that records high-score data from a simulated FIFA soccer game available online. The program will ask the user to enter the number of scores, create two dynamic arrays sized accordingly, ask the user to enter the indicated number of names and scores, and then print the names and scores sorted by score in descending order. The output from your program should look exactly like...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT