Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Extending Java Classes and Overriding Their Methods In this assessment, you will design and code a Java console application that defines a class, extends it
Extending Java Classes and Overriding Their Methods In this assessment, you will design and code a Java console application that defines a class, extends it into two other classes, overrides the toString) for all three classes, instantiates the classes into three objects, invokes the toString) on these objects, and prints out the return value of each toString() invocation. You can use either the Toolwire environment or your local Java development environment to complete this assignment. The requirements of this application are as follows. The application is to define a Java class called Course. The Course class has the following members 1. code attribute - a string field to store the course code (e.g. IT4789) 2. creditHours attribute an int field to store the credit hours of the course (e.g. 3) 3. title attribute a string field to store the title of the course (e.g. Mobile Cloud Computing Application Development) 4. Parameterized constructor with the three parameters of code, creditHours, and title. The constructor simply assigns the received values to their corresponding attributes An overridden toString) method that returns the name of the Java class (i.e. Course) and the course code assigned to the class object 5. The application need to extend the Course class into two other Java classes named 1. FlexPathCourse 2. GuidedPathCourse The FlexPathCourse class adds the following members 1. optionalResources attribute - a string field for the optional resources for a flexpath course Parameterized constructor with the three parameters of code, creditHours, and title The constructor simply assigns the received values to their corresponding attributes 2. 3. An overridden toString) method that retums the name of the Java class (i.e. FlexPathCourse) and the course code assigned to the class object duration attribute - an int field for the duration of a guidedpath course guidedpath course The constructor simply assigns the received values to their cormesponding attributes (i.e. GuidedPathCourse) and the course code assigned to the class The GuidedPathCourse class adds the following members 1. 2. requiredResources attribute - a string field for the required resources for a 3. Parameterized constructor with the three parameters of code, creditHours, and title 4. An overridden toString) method that returns the name of the Java class object The application will then instantiates three objects from the Course, FlexPathCourse, and GuidedPathCourse and invokes their corresponding toString) methods Use these attribute values when instantiating the three classes to test your application
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