dasker's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
Active Members
Active Posts:
89 (0.07 per day)
Joined:
10-November 10
Profile Views:
2,334
Last Active:
User is offline Aug 25 2013 11:43 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   dasker has not set their status

Posts I've Made

  1. In Topic: Looking to print names and age from Command line arguments

    Posted 25 Jan 2013

    Thank you I added the try/catch statement:
    I ran into an error on lines 34,35,37. can't resolve "args to a variable.
    for(int i =1; i < args.length; i += 2){
                     num += Integer.parseInt(args[i]);
                  }
                  System.out.println( "The average age is =" + num / (args.length /2));
    /code]
    
    here is the new code:
    [code}]
    public class Arguments {
    
        /**
         * @param args
         */
        public static void main(String[] args) {
          
          
          //int length = args.length;
          if((args.length <= 3 || args.length >=14)){
                System.out.println("Need more arguments");
          }       // Display the arguments from the command line
              if ( args.length%2== 1 ){
              // quit with error
    
            for(int counter = 0; counter < args.length; counter++) {
               System.out.println(args[counter]);
            }
              }
        }
      
            boolean isInt(String s){
                try {
                    Integer.parseInt(s);
                }
                catch(Exception e )
                {
                    return false;
                }
                    return true;
            
                  double num = 0;
                 for(int i =1; i < args.length; i += 2){
                     num += Integer.parseInt(args[i]);
                  }
                  System.out.println( "The average age is =" + num / (args.length /2));
            }
               
    
    }
    
    
  2. In Topic: need a return statement for calculating number of years

    Posted 9 Jan 2013

    Thanks I follwed your advice, Martyr2. I get the answer I am looking for.
    Thanks again for the help everyone!
  3. In Topic: Error in C program for printing 4 ints and 4 char.

    Posted 30 Oct 2012

    oh Geez!! Thank you!

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

dasker hasn't added any friends yet.

Comments

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