Write a program that displays the income tax due on taxable income entered by the user. Have the user enter the tax in the main() method, and then call a calcTax() method to compute the tax. Print the value returned.The calcTax() method should have one parameter - income - and return a double - tax.The tax is calculated as follows: Income Tax Due $0 - $50,0005%  $50,000-$100,000 $2,500 + 10% of (income > $50,000) > $100,000 $7,500 + 15% of (income > $100,000)

Question
Asked Oct 29, 2019
22 views

Write a program that displays the income tax due on taxable income entered by the user. Have the user enter the tax in the main() method, and then call a calcTax() method to compute the tax. Print the value returned.

The calcTax() method should have one parameter - income - and return a double - tax.

The tax is calculated as follows:

 Income  Tax Due
 $0 - $50,000 5% 
 $50,000-$100,000  $2,500 + 10% of (income > $50,000)
 > $100,000  $7,500 + 15% of (income > $100,000)
check_circle

Expert Answer

Step 1

The program that displays the income tax due on taxable income is created in java.

In calTax() method if else statement used to compute tax due.

Step 2

Program:

//import Scanner

import java.util.Scanner;

//Class created

public class texCalc {

    //main method

    public static void main(String args[]) {

        //Scanner input

      Scanner input=new Scanner(System.in);

      //varible declaration

      double income;

      //display message to user

      System.out.println("Please enter your taxable income:");

      //input from user

      income=input.nextDouble();

      //calling method calcTax()

      double result=calcTax(income);

      //printing returned value

      System.out.println("the income tax due on taxable income: $"+result);

    }

    //calcTax() method

    public static double calcTax(double income)

    {

        //varible declared

        double tax;

        //computed tax for  $0 - $50,000

        if(income>=0 && income<=50000)

        {

            tax=income*0.05;

   &...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: 5. How many times will the following do loop execute and what is the output? i 1; do { i= 2*i; cout ...

A: Determining the number of times the loop executes:The loop will execute for 5 times. The “do..while”...

question_answer

Q: MIPS assembly language please help    Write a program for a grocery store to calculate the total cha...

A: Some definitions required to know before doing this program: -1.What is Mars?2.What is MIPS?3.What i...

question_answer

Q: Suppose you have two tables: EMPLOYEE and EMPLOYEE_1. The EMPLOYEE table contains the records for th...

A: To display the output of the given tables by using UNION operator.Two tables are given:First Table n...

question_answer

Q: please just help with parts afterr //     3) Write friend function for the following class to overlo...

A: A friend function is defined outside the context of a class, but it has the rights to access the mem...

question_answer

Q: in python   Write a Python program that uses a for loop with the range function to inspect all integ...

A: Multiples() function defines to display these two totals.

question_answer

Q: This program is written in pseudocode."Design a program that generates a 7-ddigit lottery number. Th...

A: As you have not specified the programming language, we have solved this question using C++ programmi...

question_answer

Q: Hi, I have to display the first 20 Fibonacci numbers to the console. The first two numbers are given...

A: Program: class PrSpecial { public static final int N = 20; public static void main(String[] args){ i...

question_answer

Q: Siobhan’s laptop has 8GB of RAM. Her operating system takes up 2GB, andher application programs use ...

A: It also depends that whether the graphic card is installed or not otherwise an 8 Gb of RAM itself is...

question_answer

Q: Please help me with this, I'm stuck...

A: The DFA is a 5- tuple {Q, ∑, q, F, δ}:Q = {q0, q1, q2, q3, q4}∑ = w | w is a string over {a, b} that...