Results 1 to 5 of 5
  1. #1
    Dim
    Dim is offline Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    0

    Default need help with a program

    I have to write a Program for class and have no idea how to do it i need help, here is the instructions we were given.

    Comments: The banner for your program (comment at the top) should include Name, Class, Semester, Program number, and program description. Each method should have a comment describing its functionality and describing each of the parameters/return (i.e. IN and OUT) values. Additionally, all variables should be commented.

    Execution: Your program will first display your welcome message, which should include your name and a brief description of the program (with any appropriate instructions). Next it will ask for the name of a contestant. After that, it will ask the user for a score (from 0 to 10) for each of 5 areas: originality, poise, ability, audience reaction, and overall impression. Then it will display the contestant's name along with his/her total score (0 50). Lastly, it should display a closing message (funny is good).

    Implementation: You will be making your own class (JesuitContestant would be a good name) and the appropriate methods to accomplish your task. This mean you probably want: a constructor, a method to set an originality value, a method to set a poise value, etc, a method to calculate and return the total score and a method to clear the values and name. You will also need instance variables to hold the various scores and the total. You MUST use JOptionPanes for all input and output.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Well, you are going to fail if you don't start working on it.

  3. #3
    toymachiner62 is offline Member
    Join Date
    Oct 2009
    Posts
    63
    Rep Power
    0

    Default

    We don't do people's homework, we help you when you get stuck. Get a start on it and let us know where you're getting stuck.

  4. #4
    Dim
    Dim is offline Member
    Join Date
    Oct 2009
    Posts
    2
    Rep Power
    0

    Default

    Java Code:
    package jesuitgotstalent;
    
    /**
     *
     * @author Austin
     */
    public class Main {
        
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
        int arraylength = 10;
        double average;
        double score[] = new double[arraylength];
        boolean done = false;
    
        // Get input from user for scores and assign them to an array
        for (int i = 0; i < arraylength; i++) {
          System.out.print("Enter score # " + (i+1) + ":");
    
          done = false;
    
          while (!done) {
            try {
              if ((score[i] < 0.0) && (score[i] > 10.0))
                throw new NumberFormatException();
    
              
              else
                done = true;
            }
    
            catch (NumberFormatException e)
    
            {
              System.out.print("** Invalid Entry ** \nPlease re-enter score");
            }
          } 
        } 
    
        // call a method to calculate the average
        average = averageScores(score);
    
        // Display grades and average
        System.out.println("");
        System.out.println("The average grade is " + average);
    
      } 
    
      // method used to calculate the average
      public static double averageScores(double[] g) {
        double max_score = g[0], min_score = g[0];
        double total = 0.0;
        double a = 0.0;
        for (int i = 0; i < g.length; i++) {
          total = total + g[i];
          if (g[i] < min_score) {
            min_score = g[i];
          } else {
            if (g[i] > max_score) {
              max_score = g[i];
            }
          }
        }
        a = total / g.length;
        System.out.println("The maxiumum score is " + max_score);
        System.out.println("The minimum score is " + min_score);
        System.out.println("The total score is " + total);
    
        return a;
    
      } 
    }
    thats all i have i dunno how to put the out put in JOptionPane. also im not sure how to make it the contestant i think i created a contestant with this...

    Java Code:
    package jesuitgotstalent;
    
    /**
     *
     * @author 
     */
    public class contestant {
    
        public contestant(){
    
        }
    
        public void contestantScore(){
    
        }
    }
    Last edited by Fubarable; 10-17-2009 at 02:18 AM. Reason: Code tags added for readability

  5. #5
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Punch JOptionPane.java 6 into google and read the first hit.

Similar Threads

  1. Execute A program from a Program!
    By Moncleared in forum Advanced Java
    Replies: 2
    Last Post: 02-22-2009, 04:17 PM
  2. Executing a program within a program
    By gibsonrocker800 in forum New To Java
    Replies: 5
    Last Post: 05-12-2008, 08:24 AM
  3. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  4. Replies: 0
    Last Post: 10-04-2007, 09:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •