Question
I have been working on this assignment all day. And I still not able to get the problem to run: Defining Java classes is one
I have been working on this assignment all day. And I still not able to get the problem to run:
Defining Java classes is one of two steps we practice when using objects. The second step is to instantiate Java classes into objects and to use these objects in our application.
In this discussion, you will practice instantiating an already defined Java class into objects and invoking the attributes of these objects.
You can use either the Toolwire environment or your local Java development environment to complete the coding for this discussion.
Unzip the attached NetBeans project zip file (U10D1_InstantiateUseArrayOfObjects.zip) and load it into your NetBeans IDE.
The project defines two classes:
A Java class called Course (in Course.java) with certain attributes, and Another class called U10D1_InstantiateUseArrayOfObjects (in U10D1_InstantiateUseArrayOfObjects.java). This class creates an array of Course objects and initializes their attributes to specific values and then calls the WriteCurrentRegistration() to print the current list of registered classes and their total credit hours. The WriteCurrentRegistration() still needs to be coded.
Code the WriteCurrentRegistration() method to meet the stated requirements specified in the project
package u10d1_instantiateusearrayofobjects;
/**
*
*
*/
public class U10D1_InstantiateUseArrayOfObjects {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Course[] courses = {
new Course("IT1006", 6, false),
new Course("IT4782", 3, false),
new Course("IT4789", 3, false),
new Course("IT4079", 6, false),
new Course("IT2230", 3, true),
new Course("IT3345", 3, true),
new Course("IT2249", 6, false)
};
WriteCurrentRegistration(courses);
}
//This method prints the current list of registered courses thus far
//from the courses array separated by , and enclosed inside { }
//It also prints the total credit registered for thus far
public static void WriteCurrentRegistration(Course[] courses) {
//TODO:
//loop over the courses array and print
//the current list of registered courses
//separated by , and enclosed inside { }
//Also, print the total credit registered for
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started