Question
Implement a program with a main method to demonstrate the evolution of the sales tax rates in the 50 US states over the last 10
Implement a program with a main method to demonstrate the evolution of the sales tax rates in the 50 US states over the last 10 years. Declare a two-dimensional array of values representing the sales tax rates. Dimension 1 represents the state and dimension 2 represents the year.
Populate the array with random values between 0.0 and 0.06 using a nested for loop. Hint: you could use the Math.random( ) method as follows: double rand = Math.random( ) *0.06;
Print the content of the 2D array using nested for loop. Make sure to format your output using tab spaces so, the output is displayed like a table.
Use a nested for loop to return the index of the state that has the highest average tax rate over the years.
Create an array that contains the indexes of the states that have had at least one year with a tax rate less than 0.001. Hint: You would need to use a nested for loop where you would traverse each row and then each column in the row to check if the sales tax values is less than 0.001
Print the contents of the array created in earlier step using a for loop.
Use a nested for loop to print the highest sales tax rate over the years for each of the states.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started