CS
1401 Introduction to Computer Science
Fall 2014, Lab 12
Motivation: to practice exceptions.
Assignment. Define a class Course. The description
of each course should contain:
- a class title,
- the
corresponding major, and
- the number of students taking this
course.
This class should contains: - a constructor
method and
- get- and set-methods.
Make the constructor
method throw an IllegalArgumentException exception if someone
tries to input a negative number of students. Catch the exceptions
thrown by this method and print appropriate error messages.
Write a method that ask the user for the number of courses and
then forms an array of courses, by asking the user all this
information about the course.
Write a second method that, given an array of courses, prints this
information course by course.
When it is due. The program is due in the beginning of your
last lab session:
- on Wednesday December 3 for those who
attend Monday-Wednesday labs, and
- on Thursday December 4 for
those who attend Tuesday-Thursday labs.