Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Start by creating the superclass definition Course with three instance variables: course Number, a String which is the catalog number of a college course courseName,

image text in transcribed

Start by creating the superclass definition Course with three instance variables: course Number, a String which is the catalog number of a college course courseName, a String which is the name of the course credits, an int which is the course's number of credits granted which must be between zero (0) and four (4) Then code the following methods for the Course class definition: 1. A constructor method with parameters for courseNumber, courseName and credits; call the set methods below (see steps 2, 3 and 4) for the parameters 2. A set method for the instance variable courseNumber and sets the value of the instance variable from the parameter using the this reference 3. A set method for the instance variable courseName and sets the value of the instance variable from the parameter using the this reference 4. A set method for the instance variable credits that validates the parameter is between zero (0) and four (4) and sets the value of the instance variable from the parameter using the this reference 5. A get method that returns the value of courseNumber 6. A get method that returns the value of courseName 7. A get method that returns the value of credits 8. A toString method that calls each of the get methods thereby returning courseNumber, courseName and credits with appropriate labels Next create the class definition Section, a subclass of Course. The class should declare three instance variables: sectionID, an int between 10000 and 99999 that specifies the section's ID number day, a char that specifies the first day of the week that the class meets; valid values are 'M'or T' or 'W' or 'H' (Thursday) or 'F'-(for simplicity and the purposes of this application, the section meets just one day per week, not two) time, a String that specifies the time the class meets (e.g."11:00 a.m.") Then code the following methods for the Section class definition: 1. A constructor method with no parameters that sets each instance variable to its default value passing those values to the String, String, int, int, char, String constructor (see step 2) using the this reference 2. A constructor method with parameters for courseNumber, courseName, credits, sectionID, day and time by passing the parameters to the superclass constructor and to each of the set methods below (see steps 3, 4 and 5) 3. A set method for the instance variable sectionID that validates the parameter is between 10000 and 99999 as per the rule stated above and sets the value of the instance variable from the parameter using the this reference 4. A set method for the instance variable day that validates the parameter is either 'M' or 'T' or 'W' or 'H' or 'F' as per the rule stated above and sets the value of the instance variable from the parameter using the this reference 5. A set method for the instance variable time and sets the value of the instance variable from the parameter using the this reference 6. A get method that returns the value of sectionID 7. A get method that returns the value of day 8. A get method that returns the value of time 9. A toString method that calls each of the get methods thereby returning sectionID, day and time with appropriate labels, and which appropriately extends the toString method of the Course class

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

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions

Question

Why is it important to have a code of ethics?

Answered: 1 week ago