P
PB
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()));
}
}
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()));
}
}