Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The project defines two classes: A Java class called Course (in Course.java) with certain attributes, and Another class called InstantiateUseArrayOfObjects (in InstantiateUseArrayOfObjects.java). This class creates

The project defines two classes:

A Java class called Course (in Course.java) with certain attributes, and

Another class called InstantiateUseArrayOfObjects (in 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.

Course.java

public class Course { private String code = ""; private int creditHour = 0; private boolean isRegisterdFor = false; public Course(String code, int creditHour, boolean isRegisteredFor){ this.code = code; this.creditHour = creditHour; this.isRegisterdFor = isRegisteredFor; } public void setCode(String code){ this.code = code; } public String getCode() { return this.code; } public void setCrditHour(int creditHour) { this.creditHour = creditHour; } public int getCreditHour() { return this.creditHour; } public void setIsRegisteredFor(boolean trueOrFalse){ this.isRegisterdFor = trueOrFalse; } public boolean getIsRegisteredFor() { return this.isRegisterdFor; }

}

instantiateusearrayofobjects.java

package instantiateusearrayofobjects;

/** * * @author omora */ public class 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 } }

Output should look like the following:

Current course regitration: { IT2230, IT3345 } Current registration total credit = 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

Are the rules readily available?

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago