Lab Overview
In object-oriented programming, polymorphism refers to a programming language's ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes.
This lab is designed to deepen your Java object-oriented programming knowledge. You will be required to complete the following Java coding exercise:
- Exercise 1 - Polymorphism: Complete the code required to extend the HourlyEmployee and SalesEmployee classes from the Employee parent class. Next instantiate both the HourlyEmployee and SalesEmployee objects, adding both of them to an array typed as Employee. Finally, leverage polymorphism to call the specialized salary calculation on each object stored within the array.
Note: Each exercise comes with the fully completed solution code for reference in times of need.
Lab Objectives
Upon completion of this lab, you will be able to:
- Write Java code that implements inheritance structures
- Write Java code that updates an object's fields, which changes the state of the object
- Leverage polymorphism to have an object change its behaviour at runtime
- Run and debug the Java code and examine the results that are printed to the console
You should:
- Be comfortable with using a browser-based IDE
Lab Environment
This lab will start with the following AWS resources provisioned automatically for you:
- A single EC2 instance, named ide.java.platform.instance, which will have a public IP address attached. This instance will host a web-based Java IDE (based on the Visual Code editor).
To achieve the lab end state, you will be walked through the process of:
- Using your local browser, access the web-based Java IDE served from the ide.java.platform.instance
- Completing the following lab exercises:
- Exercise 1 -Polymorphism
Updates
June 16th, 2018 - Optimized creation of lab resources to reduce the time it takes to access the browser IDE by 60%
Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, Azure, GCP), Security, Kubernetes, and Machine Learning.
Jeremy holds professional certifications for AWS, Azure, GCP, Terraform, Kubernetes (CKA, CKAD, CKS).