Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class (and a client class to test it) that encapsulates the evolution of

ID: 643954 • Letter: W

Question

Write a class (and a client class to test it) that encapsulates the evolution of the sales tax rates in the 50 U.S. states over the last 10 years. Your only instance variable should be a two-dimensional array of values representing the sales tax rates. Dimension 1 represents the state and dimension 2 represents the year. Your constructor can simply be a default constructor, randomly generating the sales tax rates, which should be between 0 and 0.06. You should include the following methods:

    A method returning the index of the state that has the bigest average tax rate over the years.

    A method returning an array of indexes of the states that have had at least one year with a tax rate less than 0.001.

    A method returning the highest sales tax rate over the years for a given state (which will be a parameter)

Additional Requirements:

add a second instance variable that is a two-dimensional array that contains the name and the two character postal abbreviation for each of the states as separate fields.

see http://state.1keydata.com/state-abbreviations.php for a list of states and their abbreviations.

Since arrays can only be of a single data type you will need to create an array of double for the tax rates and an array of String for the state names and abbreviations.

the index on dimension 1 in each array will be used to relate the state name and abbreviation with it corresponding sales tax information (e.g. the first row in the sales tax array will correspond with the state Alabama provided your state name array is in ascending alphabetical order).

write the three methods described in problem 88 so that they meet the following requirements:For the method that returns the biggest average tax rate, return both the name of the state and the average tax rate.

Since a method can only return a single value you will need to create an object that contains both of the values that you need and have your method return that object.

You will need to define this object in a separate class so that both your tax class and your client class will have access to this object and its methods.

For the method that returns the array of states that have had at least one year with a tax rate less than 0.001, return both the state names and the tax rates.

Again you will need to create an object that can return both values to the client.

Again you will need to define this object in a separate class so that both the tax class and your client class will have access to this object and its methods.

For the method that returns the highest tax rate for a state over the years

Make the parameter for this method the two character state abbreviation.

This method should return the value of the highest tax rate over the years for that state.

Since the client will know what state abbreviation is being passed it only needs a single value back.

Your method only needs to return the first state with the highest value.

Create a client that tests each of your three methods

When testing the first method have your client print out the name of the state with the biggest average tax rate and the value of that average tax rate.

When testing the method that returns the states with at least one year of tax less than 0.001 print out the state names and the tax rate values in a nicely formatted, outlined grid.

An example of the grid is given at the end of this assignment.

For the method that prints out the highest sales tax for a given state print out the full name of the state and the value of the highest sales tax.

You will need to create an additional method in your tax class that will allow the client to ask for the full name of the state when passed the state abbreviation as a parameter.

Explanation / Answer

please rate it as best answer...working fine..

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote