Question
Question 1 Classes - Write a class to represent a Camera. Select the fields and methods that fit the modeling of a camera. Make sure
Question 1 Classes - Write a class to represent a Camera. Select the fields and methods that fit the modeling of a camera. Make sure to include code for the constructors, set/get methods, a to String() method.
Question 2Inheritance - Create four subclasses of Camera. Consider in your design whether there are abstract classes that should be introduced into the design. Decide which properties should be pushed up into a super abstract class and which belong in the individual subclasses. You do not need to code every method - just place a stub placeholder.
Question 3 Interface - Simulate multiple inheritance by adding at least two interfaces into your class hierarchy. Describe your decision in designing the interfaces and explain their value.
Question 4Interface - Describe how you would make the Camera class implement the Comparable Java interface. Why would you bother? Illustrate with a specific coding example.
Question 5 Polymorphism - Write a driver program that uses a Camera reference variable to point to three different types of classes, showing that inheritance is one mechanism for using polymorphism. Then give an example of how you could use the interfaces you created in question 5 to create a polymorphic reference variable.
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