Help setting up a Class

From: PB (polishp_at_tampabay.rr.com)
Date: 11/17/03

  • Next message: kevinc: "Re: Help setting up a Class"
    Date: Mon, 17 Nov 2003 01:10:24 GMT
    
    

    i have a class called school.java and i cant figure out how to construct
    another class called course.java that adds 2 people to a course. Can anyone
    help me out on how to set up constructors and such. Here is school.java

    import java.text.DecimalFormat;

    public class School
    {
       //-----------------------------------------------------------------
       // Creates some Student objects, adds them to a course, and
       // prints them.
       //-----------------------------------------------------------------
       public static void main (String[] args)
       {
          Address school = new Address ("800 Lancaster Ave.", "Villanova",
                                        "PA", 19085);

          Address jHome = new Address ("21 Jump Street", "Lynchburg",
                                       "VA", 24551);
          Student2 john = new Student2 ("John", "Smith", jHome, school,
                                        75, 88, 78);

          Address mHome = new Address ("123 Main Street", "Euclid", "OH",
                                       44132);
          Student2 marsha = new Student2 ("Marsha", "Jones", mHome, school,
                                          100, 98, 94);

          Course zoology = new Course("Zoology 101");
          zoology.addStudent(john);
          zoology.addStudent(marsha);

          zoology.roll();

          DecimalFormat formatter = new DecimalFormat("0.0#");
          System.out.println();
          System.out.println ("-------------------------------------");
          System.out.print ("Overall Test Average: ");
          System.out.println (formatter.format(zoology.average()));
       }
    }


  • Next message: kevinc: "Re: Help setting up a Class"

    Relevant Pages

    • Help setting up a Class
      ... i have a class called school.java and i cant figure out how to construct ... public static void main (String[] args) ...
      (comp.lang.java)
    • Help setting up a Class
      ... i have a class called school.java and i cant figure out how to construct ... public static void main (String[] args) ...
      (comp.lang.java.programmer)
    • Help setting up a Class
      ... i have a class called school.java and i cant figure out how to construct ... public static void main (String[] args) ...
      (comp.lang.java.help)