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

Autobiography Benjamin Franklin essay
Autobiography Benjamin Franklin essay
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...
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...
Compare and contrast Cotton Mather’s economic advice with that of Benjamin Franklin. How are they similar?...
Compare and contrast Cotton Mather’s economic advice with that of Benjamin Franklin. How are they similar? How are they different?
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...
During a voyage to England in 1757, Benjamin Franklin observed, as had sailors for centuries before...
During a voyage to England in 1757, Benjamin Franklin observed, as had sailors for centuries before him, that when cooking grease was thrown from the ship’s galley onto the water, the waves were calmed by the film that formed on the ocean surface. In 1765, Franklin followed up on this observation by placing one teaspoonful (~5 mL) of a fatty acid “oil” on a half-acre pond (roughly 2 × 107 cm2), which was just sufficient to form a condensed monomolecular...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT