Java program an income tax program that 1. generate a random number of people in the range of (1-15); 2. ask the user to enter the amount of taxable income for each person, and then displays the tax due; 3. display the people with max value of taxes on the screen.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Java program

an income tax program that

1. generate a random number of people in the range of (1-15);
2. ask the user to enter the amount of taxable income for each person, and then displays the tax due;
3. display the people with max value of taxes on the screen.
Income
Amount of tax
Not over $750
$750-$2500
$2500-$5000
$5000-$8000
Over $8000
1% of income
$7.5 plus 2% of amount over $750
$82.5 plus 4% of amount over $2500
$142.50
$230.00
plus 5% of amount over $5000
plus%6 of amount over $8000
Transcribed Image Text:Income Amount of tax Not over $750 $750-$2500 $2500-$5000 $5000-$8000 Over $8000 1% of income $7.5 plus 2% of amount over $750 $82.5 plus 4% of amount over $2500 $142.50 $230.00 plus 5% of amount over $5000 plus%6 of amount over $8000
Expert Solution
program

import java.util.*;
public class Main
{
 public static void main(String[] args) {
      int maximum=15;
      int minimum=1;
      double max_tax=0;
      Scanner sc=new Scanner(System.in);
      int random_number=(int) (Math.random()*(maximum - minimum)) + minimum;//for generating random number
      int[] a=new int[random_number];// to store income values 
      double[] tax=new double[random_number];// to store tax
      //to read read input and calculate tax based on the slab
      for(int i=0;i<random_number;i++)
      {
          System.out.println(" enter the taxable income");
          a[i]=sc.nextInt();
          if(a[i]<750)
          {
              tax[i]=a[i]*0.01;
          }
          else if(a[i]>=750 && a[i]<2500)
          {
              tax[i]=7.5+(a[i]-750)*0.02;
          }
          else if(a[i]>=2500 && a[i]<5000)
          {
              tax[i]=82.5+(a[i]-2500)*0.04;
          }
          else if(a[i]>=5000 && a[i]<8000)
          {
              tax[i]=142.50+(a[i]-5000)*0.05;
          }
          else
          {
              tax[i]=230.00+(a[i]-8000)*0.06;
          }
          
          
          System.out.println("the tax amount for "+i+1+" person is "+ tax[i]);
          if(tax[i]>max_tax)
          {
              max_tax=tax[i];
          }
          
      }
      System.out.println("the max tax amount is "+ max_tax);

 }
}

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education