Question: Lab Objectives Working with classes, inheritance, polymorphism, instanceof operator. Preparation: For this lab, you will be importing pre - existing Java source files. You will
Lab Objectives
Working with classes, inheritance, polymorphism, instanceof operator.
Preparation:
For this lab, you will be importing preexisting Java source files. You will need to download the file: LabSourceFiles.zipDownload LabSourceFiles.zip
After you download the zip file, extract in an easy location to find.
Then, in NetBeans, create a new project named Lab and drag the source files into the source package.
Labpng
Make the proper modifications to the main method according to the instructions below.
Program pts total:
Your task for this lab is to finish the program that has already been started for you. In the main method:
Add your name and the date as a comment in a visible location.
Beneath the code that is already there, create an ArrayList that holds Bicycle objects. Add the ten Bicycles that have been created above.
Using an appropriate loop, iterate through the Bicycles in the ArrayList, making certain changes depending on the subclass of the object, as follows:
If the Bicycle is a Mountain Bike, set the height to and print the bikes info using a label and the toString method see Sample Output
If the Bicycle is a Tandem Bike, set the betweenSpace to and print the bikes info using a label and the toString method.
If the Bicycle is a Road Bike, set the handlebarType to NewType and print the bikes info using a label and the toString method.
Notes:
Your output should match the Sample Output exactly.
You will need to use object casting and the instanceof operator when manipulating your objects.
Sample Output:
imgpngimgpng
Submission Instructions: To receive credit for this lab, you must turn the lab in using the method below.
Record a VidGrid screen video that shows the following:
Open the command prompt window that shows what user is logged in to the computer. See example below:
imgpng
Then, in NetBeans, scroll to show all your code, including all comments. Make sure that your project directory is visible as well. See example below:
imgpng
Show the program running from beginning to end and make sure the output window is visible.
Embed your screen video into the correct assignmentdiscussion for this lab.
DO NOT ATTACH the file or you will lose points, the video should be embedded in your discussion. Late submissions will not be graded.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
