Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem #3: Lamps (40 Points) For this problem, you will be creating a derived class, base class and an interface. No Driver is required, but

Problem #3: Lamps (40 Points)

For this problem, you will be creating a derived class, base class and an interface. No Driver is required, but I have attached one to test with. A UML diagram for this problem has been provided to assist you.

Lamp Class:

Attribute:

Color of light emitted by Lamp

Methods:

get and set methods for attribute

toString(): returns a String describing the Lamp

constructor that takes in the Lamp's color of light

------------------------------------------------------------------

Flammable Interface: Flammable should be its own interface which has a:

Method header:

boolean startOnFire(): returns if the lamp has started on fire. Returns true if the lamp is on fire, false otherwise.

------------------------------------------------------------------

LavaLamp: LavaLamp should be its own class and should inherit from Lamp and implement Flammable. LavaLamp should have:

Attributes:

number of color blobs

Methods:

get and set methods for attribute

toString(): returns a String describing the LavaLamp

constructor which takes in the LavaLamp's light color

constructor which takes in the LavaLamp's light color and the number of color blobs in the LavaLamp

Flammable() returns true 3% of the time (must use Random object to generate this)

Grading Breakdown:

10 -- Correctly creating your Interface

10 -- Correctly creating your Base Object

10 -- Correctly creating your Derived Object

10 -- Correctly connecting your data using the correct keywords, etc.

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

Step: 3

blur-text-image

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions