Write a java console application that allows the user to read, validate, store, display, sort and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a java console application that allows the user to read, validate, store, display, sort and search data (name, age, taxable income, tax, tax group) for N taxpayers. N should be declared as a constant and it should be equal to the largest digit of your student id number (e.g. if your ID number is $1267222 then N should be equal to 7 and you can declare it as final int N-7:). The name, age and taxable income must be read from the keyboard and tax and tax group must be calculated using Table 1. Table 1. Income Tax and Tax Group for Taxable Income Income Tax Taxable Income $0-$18200 $18201-$37000 $37001 - $87000 $87001-$180000 $180001 and over $0 $0 plus 19c for each $1 over $18200 $3572 plus 32.5c for each $1 over $37000 $19822 plus 37c for each $1 over $87000 $54097 plus 45c for each $1 over $180000 Tax Group Group 1 1. Read, validate and store data for N taxpayers 2. Calculate and store tax and tax group for all taxpayers 3. Display all taxpayers 4. Display the name and age of all taxpayers from tax group 1 5. Search a taxpayer by age 6. Sort and display taxpayers 7. Exit from the application Group 2 Group 3 Group 4 Group 5 The name, age, taxable income, tax and tax group must be stored in an Array or ArrayList (index 0 for taxpayer 1 and index N-1 for taxpayer N). The minimum and maximum ages which can be stored are 18 and 64. The minimum and maximum taxable incomes which can be stored are $1 and $999000. A validation for minimum and maximum values must be done during the reading of age and taxable income. Your application should display and execute a menu with the following options. A switch statement must be used to execute the following menu options. 1. Read, validate and store data for N taxpayers This option reads name, age and taxable income for N taxpayers from the keyboard and stores them in an Array or ArrayList. If the age is less than 18 and greater than 64 then an appropriate message should be displayed and the user should be asked to enter the age again. Similarly if the taxable income is less than $1 and greater than $999000 then an appropriate message should be displayed and the user should be asked to enter the taxable income again. 2. Calculate and store tax and group number for all taxpayers This option calculates the tax and group number based on Table 1 for each taxpayer and then stores tax and group number in Array or ArrayList. 3. Display all taxpayers This option displays the data (name, age, taxable income, tax, group number) for all taxpayers. 4. Display the name and age of all taxpayers from tax group 1 This option displays the name and age of all taxpayers from tax group 1. If there is no taxpayer in group 1 then it displays an appropriate message. 5. Search a taxpayer by age This option asks user to enter the taxpayer's age and searches for it. If the age is found then it displays an appropriate message with taxpayer details (name, age, taxable income, tax, group number). If age is not found then it displays an appropriate message "taxpayer with given age is not found". If there is more than one taxpayer with the given age then it displays all of them. A built-in search algorithm is not allowed in this assignment. 6. Sort and display taxpayers This option sorts (by name) all taxpayers stored in Array or ArrayList in descending order and displays all sorted taxpayers (name, age, taxable income, tax, group number). You can use any sorting algorithm. A built-in sort algorithm for sorting is not allowed in this assignment. 7. Exit from the application The application should display an appropriate message with student name and then exit from the application. The application should work in a loop to enable the user to read, validate and store data for all taxpayers, calculate and store tax and tax group for all taxpayers, display all taxpayers, display the name and age of all taxpayers from tax group 1, search a taxpayer by age, sort and display taxpayers and exit from the application Program design You may use any design that meets the specification. However, a good design will adhere to the following guidelines: ● be logically correct • ● ● ● be easy to read and maintain be well-designed use a UML activity diagram use appropriate classes, methods and fields Your design MUST use the classes as listed below. public class Taxpayer { //fields to store name, age, taxable income, tax, group number //relevant methods including set and get methods } public class TaxpayerTest { public static void main(String[] args) //menu options using switch statement //data reading, Taxpayer object creation, data storing in array/arrayList, etc. } //other static methods. You may add/use methods, parameters, fields/variables, constants, etc. which you need to complete the application. Write a java console application that allows the user to read, validate, store, display, sort and search data (name, age, taxable income, tax, tax group) for N taxpayers. N should be declared as a constant and it should be equal to the largest digit of your student id number (e.g. if your ID number is $1267222 then N should be equal to 7 and you can declare it as final int N-7:). The name, age and taxable income must be read from the keyboard and tax and tax group must be calculated using Table 1. Table 1. Income Tax and Tax Group for Taxable Income Income Tax Taxable Income $0-$18200 $18201-$37000 $37001 - $87000 $87001-$180000 $180001 and over $0 $0 plus 19c for each $1 over $18200 $3572 plus 32.5c for each $1 over $37000 $19822 plus 37c for each $1 over $87000 $54097 plus 45c for each $1 over $180000 Tax Group Group 1 1. Read, validate and store data for N taxpayers 2. Calculate and store tax and tax group for all taxpayers 3. Display all taxpayers 4. Display the name and age of all taxpayers from tax group 1 5. Search a taxpayer by age 6. Sort and display taxpayers 7. Exit from the application Group 2 Group 3 Group 4 Group 5 The name, age, taxable income, tax and tax group must be stored in an Array or ArrayList (index 0 for taxpayer 1 and index N-1 for taxpayer N). The minimum and maximum ages which can be stored are 18 and 64. The minimum and maximum taxable incomes which can be stored are $1 and $999000. A validation for minimum and maximum values must be done during the reading of age and taxable income. Your application should display and execute a menu with the following options. A switch statement must be used to execute the following menu options. 1. Read, validate and store data for N taxpayers This option reads name, age and taxable income for N taxpayers from the keyboard and stores them in an Array or ArrayList. If the age is less than 18 and greater than 64 then an appropriate message should be displayed and the user should be asked to enter the age again. Similarly if the taxable income is less than $1 and greater than $999000 then an appropriate message should be displayed and the user should be asked to enter the taxable income again. 2. Calculate and store tax and group number for all taxpayers This option calculates the tax and group number based on Table 1 for each taxpayer and then stores tax and group number in Array or ArrayList. 3. Display all taxpayers This option displays the data (name, age, taxable income, tax, group number) for all taxpayers. 4. Display the name and age of all taxpayers from tax group 1 This option displays the name and age of all taxpayers from tax group 1. If there is no taxpayer in group 1 then it displays an appropriate message. 5. Search a taxpayer by age This option asks user to enter the taxpayer's age and searches for it. If the age is found then it displays an appropriate message with taxpayer details (name, age, taxable income, tax, group number). If age is not found then it displays an appropriate message "taxpayer with given age is not found". If there is more than one taxpayer with the given age then it displays all of them. A built-in search algorithm is not allowed in this assignment. 6. Sort and display taxpayers This option sorts (by name) all taxpayers stored in Array or ArrayList in descending order and displays all sorted taxpayers (name, age, taxable income, tax, group number). You can use any sorting algorithm. A built-in sort algorithm for sorting is not allowed in this assignment. 7. Exit from the application The application should display an appropriate message with student name and then exit from the application. The application should work in a loop to enable the user to read, validate and store data for all taxpayers, calculate and store tax and tax group for all taxpayers, display all taxpayers, display the name and age of all taxpayers from tax group 1, search a taxpayer by age, sort and display taxpayers and exit from the application Program design You may use any design that meets the specification. However, a good design will adhere to the following guidelines: ● be logically correct • ● ● ● be easy to read and maintain be well-designed use a UML activity diagram use appropriate classes, methods and fields Your design MUST use the classes as listed below. public class Taxpayer { //fields to store name, age, taxable income, tax, group number //relevant methods including set and get methods } public class TaxpayerTest { public static void main(String[] args) //menu options using switch statement //data reading, Taxpayer object creation, data storing in array/arrayList, etc. } //other static methods. You may add/use methods, parameters, fields/variables, constants, etc. which you need to complete the application.
Expert Answer:
Answer rating: 100% (QA)
Solution public class TaxPayer int size int age String name double taxableincome double tax int taxgroup TaxPayerint MAXSIZE thisage new intMAXSIZE thisname new StringMAXSIZE thistaxableincome new dou... View the full answer
Related Book For
Personal Finance Turning Money into Wealth
ISBN: 978-0134730363
8th edition
Authors: Arthur J. Keown
Posted Date:
Students also viewed these programming questions
-
Explore the concept of liminality as it pertains to the transitional spaces and psychological states depicted in the poetry of T.S. Eliot.
-
Create a program that allows the user to create an estimate of the cost to build a table. This will be a menu-driven program that will continue until the user specifically states that they do not...
-
A software company sells three packages, Package A, Package B, and Package C, which retail for $99, $199, and $299, respectively. Quantity discounts are given according to the following table:...
-
What is the coefficient of sliding friction and what is a representative value for this coefficient for the brittle crust?
-
In following Exercises, find the expected value for the random variable having the specified histogram. 1. 2. 3. 4. .4 .3 .2 .1 0. 4 2. .4 .2 .1 6. 7
-
EDGAR, the Electronic Data Gathering, Analysis, and Retrieval system, performs automated collection, validation, indexing, and forwarding of submissions by companies and others who are required by...
-
Why do auditors not usually rely on substantive tests alone when auditing accounts payable that result from credit purchase transactions?
-
Analysts following the Tomkovick Golf Company were given the following balance sheet information for the years ended June 30, 2011 and June 30, 2010: In addition, it was reported that the company had...
-
Suppose a student has 4 ties and 2 shirts and there is one pink tie and one pink shirt. Consider that the student is indifferent among the shirts and ties. That is, any shirt or tie is equally...
-
Amazon Wood Products, Inc. is a manufacturer of fine quality tables, chairs, and desks. The following information relates to expected production, sales, and other costs for next year (ended December...
-
Why are future value factor tables not as common as they once were?
-
What does it mean to position your most important accomplishments first and why is this important?
-
How is a selection interview different from other types of interviews?
-
What strategies are useful when searching for a job?
-
What do we mean when we say that attributions vary in locus, stability, and controllability?
-
What are some ways of identifying the key abilities and attributes employers are seeking for unfilled positions?
-
Evaluate, correct to 4 decimal places: (a) secant 5.37 (b) cosecant pai/4 (c) cotangent pai/24
-
What is the difference between adsorption and absorption?
-
Paul just graduated from college and landed his first real job, which pays $33,000 a year. In 10 years, what will he need to earn to maintain the same purchasing power if inflation averages 3 percent?
-
Suppose that you are interested in purchasing a bond issued by the VPI Corporation. The bond is quoted in the Wall Street Journal as selling for 88.375. How much will you pay for the bond if you...
-
Calculate the total 2017 tax liability for a surviving spouse with one dependent child with a gross income of $46,250, no salary reductions for employer-provided benefits, and no itemized deduction.
-
A floating 40-in.-thick piece of ice sinks 1 in. with a \(500-\mathrm{lb}\) polar bear in the center of the ice. What is the area of the ice in the plane of the water level? For seawater, \(S=1.03\).
-
Obtain a photograph/image of a situation in which Archimedes's principle is important. Print this photo and write a brief paragraph that describes the situation involved.
-
A spherical balloon filled with helium at \(40^{\circ} \mathrm{F}\) and \(20 \mathrm{psia}\) has a 25 - \(\mathrm{ft}\) diameter. What load can it support in atmospheric air at \(40^{\circ}...
Study smarter with the SolutionInn App