Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Create a file Course.java and a file University.java. The University.java file will be your driver class, so put a University class in it and
1. Create a file "Course.java" and a file "University.java". The University.java file will be your driver class, so put a University class in it and add a "main" method in that class. 2. In the Course.java file, write the code for a class Course, that contains 3 instance variables: ID (e.g., "CS1073"), schedule (e.g., "MWF12:30PM"), and instructor (e.g., "J. Tasse"). All 3 variables should be of type String. Add a constructor in your Course class, that takes 3 parameters, and that initializes the3 instance variables with the 3 values passed in the parameters. 3. In the driver class (main method), create a Course object with the information above for CS1073 4. Add an accessor method for the schedule variable (i.e., a getSchedule method) in your Course class. 5. In the main method, call the getSchedule method on the object you created in Step 4. Save the schedule returned in a variable and print this variable on the screen. Run your program to see if it works as expected. 6. 7. Add a mutator method for the schedule variable (i.e., a setSchedule method) in your Course class. In the main method, make the proper call to change the schedule of your object (representing CS1073) to "MWF3:30PM". Note: before you panic, this change is not being made for real! 8. 9. Add a "toString" method to your Course class. Make it build a string like "CS1073 at MWF12:30PM taught by J. Tasse" 10. In the main method, print the following on the screen: I am registered to the course CS1073 at MWF3:30PM taught by J. Tasse this semester. In order to do so, only use concatenation (of some string and of your object). As a reminder, trying to print your object will automatically call the toString method. Run your program again
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started