Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 13th, 2012, 02:43 PM
RomStock RomStock is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 RomStock User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 47 sec
Reputation Power: 0
Homework - Mutli-Dimensional Arrays

Hey everyone, I could use some help with a homework problem that i am not understanding. Here is the problem:

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 dimension2 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. A method returning the index of the state that has the biggest average tax rate over the years.

b. 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

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


so far i have:

public Taxes()
{
Random random = new Random();
for (double i = 0; i < 50; i++)
{
for (double j = 0; j < 10; j++)
{
taxRate[i][j] = random.nextDouble( 0.06);
}
}
}

which doesn't even work. If i could get help with what I have and an idea for the three methods that would be awesome. Thanks guys!!

Reply With Quote
  #2  
Old November 14th, 2012, 08:35 AM
bullet's Avatar
bullet bullet is offline
Java Junkie
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jan 2004
Location: Mobile, Alabama
Posts: 3,824 bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level)bullet User rank is General 4th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 6 Days 8 h 43 m
Reputation Power: 1248
Send a message via ICQ to bullet Send a message via AIM to bullet Send a message via MSN to bullet
Code:
public Taxes()
    {
        Random random = new Random();
        for (double i = 0; i < 50; i++)
        {
            for (double j = 0; j < 10; j++)
            {
                taxRate[i][j] = random.nextDouble( 0.06);
            }
        }
    }


This will work if you define taxRate.

The statement of the problem seems pretty straightforward.

Where are you having a problem with it?

Is it in what is being asked or the code?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Homework - Mutli-Dimensional Arrays

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap