Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Define plexus.

Answered: 1 week ago