natecat's Profile User Rating: *****

Reputation: 47 Craftsman
Group:
Active Members
Active Posts:
210 (0.4 per day)
Joined:
19-December 11
Profile Views:
1,716
Last Active:
User is offline May 13 2013 08:56 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0
Icon   natecat is so awesome, he can't even think of a status that reflects his awesomeness

Posts I've Made

  1. In Topic: Identifier Expected Error in Java

    Posted 11 Apr 2013

    You don't put the type parameters with the constructor when declaring generics.
    http://docs.oracle.c...rics/types.html
  2. In Topic: Filestatistics problem with imports

    Posted 11 Apr 2013

    You are double-declaring variables, and referencing never-defined variables, has nothing to do with imports.
  3. In Topic: Dr Java does not recognize Math class

    Posted 8 Mar 2013

    View PostJackB121, on 08 March 2013 - 09:47 PM, said:

    No, that was not my intention. I'm just trying to learn and to get this program to run properly. I still do not understand why I am getting an error message where I pointed it out, nor can I get the program to find the maximum of the 5 integer values, any thoughts?

    That's not what Math.max() does. http://docs.oracle.c.../lang/Math.html look at that to find what it actually does. If you really want to do that, every time they enter a value, if that value is greater then some int variable, set the int variable to that value.
  4. In Topic: Dr Java does not recognize Math class

    Posted 8 Mar 2013

    View PostJackB121, on 08 March 2013 - 08:36 PM, said:

    Here is my new code.

    //This program is to calculate the sum, average, and maximum of 5 numbers.
    
    import javax.swing.JOptionPane;
    
    public class numberFacts
    {
      public static void main (String[] args)
      {
        
        String input;
        int numbers = 5;
        int sum = 0;
        int average = 0;
        int max = Integer.MIN_VALUE;
        
        
        for(int counter = 0; counter<numbers; counter++) 
        {
          input = JOptionPane.showInputDialog("Please enter an integer number.");
          int num = Integer.parseInt(input);
          
          sum += num;
          
          max = Math.max(max, num);
        }
    
        average = (sum/5);
    
         JOptionPane.showMessageDialog(null,
                                        "The sum of the numbers is " + sum);
         JOptionPane.showMessageDialog(null,
                                       "The average of the numbers is " + average);
         JOptionPane.showMessageDialog(null,
                                       "The maximum of the numbers is " + max);
        System.exit(0);
      }
    }
    
    


    I am still getting the "cannot find symbol" error message for line 24, I am confused

    Also, is there a way to write this code without using the MIN_VALUE? We have not covered this in class yet. Although I'm sure it would not lose me points, I just don't know its application or understand it, and I'd like to be able to complete the assignment without using parts of code I do not understand.


    Uhm, Integer.MIN_VALUE is the field that represents -2^32, and I'm assuming that is not your intention. I think the original poster meant for you to change that, not just copy and paste the code...
  5. In Topic: java credit card validation

    Posted 5 Mar 2013

    Please describe your problem better

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Seattle, WA
Interests:
Gaming, Coding, Biking, and sleeping.
Full Name:
Nathan Wright
Years Programming:
2
Programming Languages:
Java, C++

Contact Information

E-mail:
Private

Friends

Comments

natecat has no profile comments yet. Why not say hello?