Question: Create a new Java file, and name it Course.java. (You do not need to prefix it with your name this time.) Name the class appropriately

 Create a new Java file, and name it Course.java. (You donot need to prefix it with your name this time.) Name the

Create a new Java file, and name it Course.java. (You do not need to prefix it with your name this time.) Name the class appropriately to match. You have been provided with a main program file, called TestAlQl.java. Create five instance variables: a String for the course title, a String for the department offering the course, an integer for the program year of the course (1 ,, year course, 2^d year course, etc.), an integer for the term (1, 2 or 3, indicating Winter, Spring and Fall terms) and a String course registration number (CRN) that uniquely identifies the course. All variables should be private. Additionally, create a class variable called numCou rs es, an integer, which will keep track of the number of Course objects that have been created. Initialize it to zero. Create only a single constructor that accepts four parameters: the course title, the department, the term and the program year of the course. This constructor should also assign a unique CRN to the Course. All CRNs start with "2016", followed by the term (a single digit), and finally a sequence number (3 digits, starting at "001", and incrementing by 1 each time a course is added. Use the numCourses variable to do this.). Write accessor ("get" or "getter") methods for all five instance variables. Do not define any mutators ("set" or "setter" methods). Define a toSt r ing() method that returns the CRN, term, title, department, and year, in the format shown in the lines of output in the example below (not including the leading blanks). Note that the term is printed as names, not the numeric value. Declare a constant array of Strings for printing the term names (i.e. don't use if -statements)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!