Create a class called Classroom which contains the main method. This class creates an array of 5 students and calls the setName and setAverage methods. Using the console, send in a name and average for every student.
Create two integer variables called a and b. a gets a random value from 0 – 2 and b gets a random value from 3 – 5.
Then, using the student array you created earlier, use a and b as indexes and create a student array of 2 elements. Assign the students object[a] and [b] to the two element student array. Create a Teacher object. Call the initializeStudents method and send the student object with the two elements. Do this twice.
Then call the showStudents method.
xolani.ntsiba.7 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
stultuske 1,116 Posting Maven Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.