Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Hurricane java Code

  1. #1
    Junior Member
    Join Date
    Aug 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Hurricane java Code

    I'm taking a really vague online computer science course, and am very confused on the following assignment. The lessons are only a few pages long and do not fully explain the topic completely.

    This is the assignment:
    Write a program to calculate the average category, pressure, and wind speed of all Atlantic Hurricanes that have occurred from 1980 - 2006. Also tally the number of storms in each category.
    I'm really confused, the following is the starter code given to me.

    import java.util.Scanner;
    import java.io.File;
    import java.io.IOException;
     
    public class Hurricanes2
    {
        public static void main(String[] args)throws IOException
        {
        	//declare and initialize variables
     
     
    		int arrayLength = 59;
            int [] year = new int[arrayLength];
            String [] month = new String[arrayLength];
     
     
     
            File fileName = new File("hurcdata2.txt");
            Scanner inFile = new Scanner(fileName);
     
            //INPUT  - read data in from the file
            int index = 0;
            while (inFile.hasNext())
            {
                year[index] = inFile.nextInt();
                month[index] = inFile.next();
                index++;
            }
            inFile.close();
     
     
    		//PROCESSING - calculate and convert values
    		// convert windspeed from knots to MPH
    		// determine category
    		// count number of each category
     
     
            //Find min, max and average for category, windspeed and pressure
     
     
     
            //Output - print table using printf to format the columns
     
     
            System.out.println("                      Hurricanes 1980 - 2006");
            System.out.println();
            System.out.println("Year     Hurricane    Category     Pressure (mb)     Wind Speed (mph)");
            System.out.println("=====================================================================");
     
     
     
            System.out.println("=====================================================================");
     
     
     
        }//end main()
    }//end Hurricanes2

    And this is the information from the file
    1980 Aug 945 100 Allen
    1983 Aug 962 100 Alicia
    1984 Sep 949 100 Diana
    1985 Jul 1002 65 Bob
    1985 Aug 987 80 Danny
    1985 Sep 959 100 Elena
    1985 Sep 942 90 Gloria
    1985 Oct 971 75 Juan
    1985 Nov 967 85 Kate
    1986 Jun 990 75 Bonnie
    1986 Aug 990 65 Charley
    1987 Oct 993 65 Floyd
    1988 Sep 984 70 Florence
    1989 Aug 986 70 Chantal
    1989 Sep 934 120 Hugo
    1989 Oct 983 75 Jerry
    1991 Aug 962 90 Bob
    1992 Aug 922 145 Andrew
    1993 Aug 960 100 Emily
    1995 Aug 973 85 Erin
    1995 Oct 942 100 Opal
    1996 Jul 974 90 Bertha
    1996 Sep 954 100 Fran
    1997 Jul 984 70 Danny
    1998 Aug 964 95 Bonnie
    1998 Sep 987 70 Earl
    1998 Sep 964 90 Georges
    1999 Aug 951 100 Bret
    1999 Sep 956 90 Floyd
    1999 Oct 987 70 Irene
    2002 Oct 963 80 Lili
    2003 Jul 979 80 Claudette
    2003 Sep 957 90 Isabel
    2004 Aug 972 70 Alex
    2004 Aug 941 130 Charley
    2004 Aug 985 65 Gaston
    2004 Sep 960 90 Frances
    2004 Sep 946 105 Ivan
    2004 Sep 950 105 Jeanne
    2005 Jul 992 65 Cindy
    2005 Jul 930 130 Dennis
    2005 Jul 929 135 Emily
    2005 Aug 975 85 Irene
    2005 Aug 902 150 Katrina
    2005 Sep 960 100 Maria
    2005 Sep 979 80 Nate
    2005 Sep 976 80 Ophelia
    2005 Sep 985 70 Phillipe
    2005 Sep 897 150 Rita
    2005 Sep 979 70 Stan
    2005 Sep 987 65 Vince
    2005 Sep 882 150 Wilma
    2005 Sep 960 100 Beta
    2005 Sep 979 75 Epsilon
    2006 Aug 995 65 Ernesto
    2006 Sep 972 80 Florence
    2006 Sep 955 105 Gordon
    2006 Sep 954 110 Helene
    2006 Sep 985 75 Isaac
    Last edited by helloworld922; August 12th, 2013 at 09:40 PM. Reason: please use [code] tags


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Hurricane java Code

    You need to ask a specific question. You have posted the assignment, the code and the data set. From that I can only assume that you are hoping someone to do the work for you.
    Improving the world one idiot at a time!

Similar Threads

  1. Replies: 0
    Last Post: May 23rd, 2013, 04:35 PM
  2. Trouble Porting my Java File Reading Code to Android Code
    By Gravity Games in forum Android Development
    Replies: 0
    Last Post: December 6th, 2012, 04:38 PM
  3. Replies: 5
    Last Post: November 14th, 2012, 10:47 AM
  4. Replies: 3
    Last Post: September 3rd, 2012, 11:36 AM
  5. problem in my code java code graph editeur
    By kisokiso in forum Java Theory & Questions
    Replies: 5
    Last Post: January 6th, 2012, 08:36 AM