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...
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...
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...
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...
PYTHON ONLY NO JAVA! PLEASE INCLUDE PSEUDOCODE AS WELL! Program 4: Design (pseudocode) and implement (source...
PYTHON ONLY NO JAVA! PLEASE INCLUDE PSEUDOCODE AS WELL! Program 4: Design (pseudocode) and implement (source code) a program (name it LargestOccurenceCount) that read from the user positive non-zero integer values, finds the largest value, and counts it occurrences. Assume that the input ends with number 0 (as sentinel value to stop the loop). The program should ignore any negative input and should continue to read user inputs until 0 is entered. The program should display the largest value and...
For this assignment you will develop pseudocode and write a C++ program for a simple calculator....
For this assignment you will develop pseudocode and write a C++ program for a simple calculator. You will create both files in Codio. Put your pseudocode and C++ code in the files below. PSEUDOCODE FILE NAME: Calculator.txt C++ SOURCE CODE FILE NAME : Calculator.cpp DESCRIPTION: Write a menu-driven program to perform arithmetic operations and computations on a list of integer input values. Present the user with the following menu. The user will choose a menu option. The program will prompt...
I need a pseudocode and UML for this program. import java.util.Random; public class SortandSwapCount {   ...
I need a pseudocode and UML for this program. import java.util.Random; public class SortandSwapCount {    public static void main(String[] args) {        //Generate random array for test and copy that into 3 arrays        int[] arr1=new int[20];        int[] arr2=new int[20];        int[] arr3=new int[20];        int[] arr4=new int[20];        Random rand = new Random();        for (int i = 0; i < arr1.length; i++) {            //Generate random array...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT