1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Norma-Jean [14]
3 years ago
10

The original U.S. income tax of 1913 was quite simple. The tax was

Computers and Technology
1 answer:
Svetradugi [14.3K]3 years ago
7 0

Answer:

       Scanner inputObject = new Scanner(System.in);

       System.out.print("Enter your income to calculate the tax: ");

       double income = inputObject.nextDouble();

       double tax = 0;

       if (income <= 50000) {

           tax = income * 0.01;

       }

       else if (income > 50000 && income <= 75000) {

           tax = income * 0.02;

       }

       else if (income > 75000 && income <= 100000) {

           tax = income * 0.03;

       }

       else if (income > 100000 && income <= 250000) {

           tax = income * 0.04;

       }

       else if (income > 250000 && income <= 500000) {

           tax = income * 0.05;

       }

       else if (income >= 500000) {

           tax = income * 0.06;

       }

       System.out.printf("Your tax is: $%.2f", tax);

Explanation:

Here is the Java version of the solution. The user is asked to enter the income and the tax is printed accordingly.

<em>Scanner</em> class is used to take input from user, and the value is stored in <em>income</em> variable. A variable named <em>tax</em> is initialized to store the value of the tax.

Then, if structure is used to check the <em>income</em> value. This <em>income</em> value is checked to decide the amount of the tax will be paid. For example, if the <em>income</em> is $100000, the tax will be calculated as tax = 100000 * 0.03 which is equal to $3000.00. After calculating the <em>tax</em> value, it is printed out using System.out.printf("Your tax is: $%.2f", tax);.

Be aware that the values are <u>double,</u> <u>printf</u> is used to print the value. "<u>%.2f</u>" means print the<em> </em><u>two decimal values</u> in the result.

You might be interested in
What is commodity? explain
timama [110]
A raw material or primary agricultural product that can be bought and sold, such as copper or coffee.
6 0
3 years ago
Create a function (prob3_6) that will do the following: Input a positive scalar integer x. If x is odd, multiply it by 3 and add
aniked [119]

Answer:

Following are the program in python language

def prob3_6(k): #function definition

  c = 0 #variable declaration

  while k != 1: #iterating the while loop

      print(k) #print k

      if k % 2 == 0:#check if condition  

          k= k // 2 #divisible by 2

      else: #else condition

          k = k * 3 + 1  

      c = c + 1

  print(k) #print k

  print c #print count

prob3_6(3)#function call

Output:

3

10

5

16

8

4

2

1

7

Explanation:

Following are the description of program

  • Create a function "prob3_6" in this function we passing an integer parameter of type "int" named "k".
  • Inside that function we declared a variable "c" of type "int" that is used for counting purpose .
  • After that we iterated the while for print the value of when it is not equal to 1 .
  • We check if condition when k gives 0 on modulus then k is divisible by 2 otherwise else block will be executed in the else part we multiply by 3 to k and add 1 to the k variable .
  • Finally print "k" and "c"

5 0
3 years ago
Write a function called first_last that takes a single parameter, seq, a sequence. first_last should return a tuple of length 2,wh
motikmotik

Answer:

The Python code with the function is given below. Testing and output gives the results of certain chosen parameters for the program

Explanation:

def first_last(seq):

   if(len(seq) == 0):

       return ()

   elif(len(seq) == 1):

       return (seq[0],)

   else:

       return (seq[0], seq[len(seq)-1])

#Testing

print(first_last([]))

print(first_last([1]))

print(first_last([1,2,3,4,5]))

# Output

( )

( 1 , )

( 1 , 5 )

5 0
3 years ago
Adding Web pages helps Web designers ___. Choose all answers that are correct.
ss7ja [257]

Answer:

B

Explanation:

7 0
3 years ago
Someone learn me more American Sign Language (ASL). Please.
sveticcg [70]

Answer:

Ok I will

Explanation:

3 0
3 years ago
Other questions:
  • A ____________ variable is available throughout a program.
    7·1 answer
  • Assume the following variable definitions int a = 5, b = 12; double x = 3.4, z = 9.1. What are the values of the following expre
    7·1 answer
  • 3. If the typical balance on Lucy's credit card is $750 and the interest rate (APR) on her credit card is 16%, how much in inter
    11·2 answers
  • Write a python program that requests a word (with lowercase letters) as input and translates the word into pig latin. The rules
    15·2 answers
  • //Display message Module main () // Declare variables Declare real weight Declare real shipping //Get package weight Call getWei
    7·1 answer
  • . A possible data for source that could be used when completing a mail merge could be a(n)… : *
    13·2 answers
  • The best way to safeguard your document is to save it
    11·1 answer
  • You scan the network and find a counterfeit access point that is using the same SSID as an already existing access point. What i
    12·1 answer
  • How does a project charter support the project manager in getting things for the project from other people?
    6·1 answer
  • Which role will grant a delegate read-only access to a particular workspace within a user’s Outlook mailbox?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!