Assignments

CS506 Assignment 1 Solution Fall 2026

CS506 Web Design and Development Assignment 1 for Fall 2026 asks you to complete a Java Course class for keeping university course records. The assignment carries 20 marks and the submission is the Course.java file only, or a text file if Java upload is blocked. The main method inside the TestCourse class is already given in the question, so your class must fit it exactly. The solution file linked below contains the complete Course class.

What Does the Solution File Cover?

What Fields and Methods Does the Course Class Need?

The class keeps four data members: courseCode as a String, courseTitle as a String, creditHours as an int, and a static int named courseCount that is shared by all objects. It needs a parameterized constructor that uses the this reference to set the three instance fields and increments courseCount on every new object. It also needs getCourseTitle to return the title, setCreditHours to update the hours, display to print code, title and hours, and a static displayCourseCount method. The same object oriented ideas appear in the CS201 Assignment 1 solution on classes and objects.

How Does the Given Main Method Use the Class?

The given main method creates one Course object for CS506, Web Design and Development, with 2 credit hours, then calls display, prints the title through getCourseTitle, changes the hours to 3 with setCreditHours, calls display again, and finally calls Course.displayCourseCount. Your class must match every one of these calls, including the exact method names and the static call through the class name. A similar given-main pattern is explained in the CS202 Assignment 1 solution.

What Output Does the Program Produce?

Running the given main method with the solution class prints the course code CS506, the title Web Design and Development, and 2 credit hours, then the title again, then the updated information with 3 credit hours, and finally Total Courses Created: 1, because only one object was created. Trace the main method line by line against the class and you will see each line of output appear in this order.

How Do You Download the Solution File?

You can download the complete Course.java file from Google Drive using the link below. Submit only the Course.java file on VULMS. Do not include the TestCourse class or the main method in your submission, because the question provides them already. Replace nothing else in the code, since the given main method depends on the exact method names.

Frequently Asked Questions

Why is courseCount declared static?

Because it must count objects across the whole class, not per object. A static field belongs to the class itself, so every new Course object increments the same counter.

What does this do inside the constructor?

It separates the fields from the parameters when both have the same name. Writing this.courseCode = courseCode stores the parameter value into the object’s own field instead of assigning the parameter to itself.

Why does setCreditHours take a parameter with the same name as the field?

That is the standard setter pattern: the parameter carries the new value, and this.creditHours = creditHours writes it into the field. The given main method calls setCreditHours(3), so the signature must accept one int.

Last updated: November 2026.

Hostinger - Get 20% OFF

Habib ur Rehman

Hello! I'm the founder of VU Tech Geek. As a BSCS graduate and experienced WordPress professional, I'm passionate about technology and education. My Virtual University journey has given me valuable insights and knowledge, which I love to share with fellow students.… More »

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker