Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment For this project we will practice using abstract classes and inheritance by creating a hierarchy of Emoji. Here it a UML class diagram that

Assignment

For this project we will practice using abstract classes and inheritance by creating a hierarchy of Emoji. Here it a UML class diagram that shows the classes we will be creating:

image text in transcribed

Notice in the diagram that Emoji and FaceEmoji are both abstract classes. (Remember that in the UML, italic font is used to indicate abstract classes and methods.)

Here's a description of what each class should contain:

Emoji class:

Private instance variables for the position and size of the emoji.

A constructor with three parameters. The constructor should initialize the three instance variables.

Public accessor (get) methods for each of the instance variables.

Abstract draw and animate methods.

FaceEmoji class:

A private instance variable that is used to indicate if the eye is winking.

A constructor.

A draw method that draws the yellow circle and eyes of the face.

An animate method that causes one eye to wink.

SmileyFaceEmoji class:

A constructor.

A draw method that calls the FaceEmojis draw method and then adds a smile.

FrowningFaceEmoji class:

A constructor

A draw method that calls the FaceEmojis draw method and then adds a frown.

ClockEmoji class:

Two private instance variables that store the current hour and minute.

A constructor that has two extra parameters for the hour and minute.

A draw method.

An animate method that moves the minute hand ahead one minute. The hour hand should be updated when appropriate.

EmojiDriver class:

The driver class should read input from a text file. The text file contains information about a grid of emoji. The first two numbers in the file indicate the number of rows and the number of columns. The text file then lists the emoji that should fill in the grid. "smile" means the emoji should be a SmileyFaceEmoji, "frown" means a FrowningFaceEmoji, and "clock" means ClockEmoji. The clock command is always followed by two integers representing the initial hour and minute of the clock.

The driver class should set the size of the StdDraw canvas based on the number of rows and columns. It should then repeatedly call the draw and animate methods on each Emoji object. The program should continue until the StdDraw window is closed.

Emoji -centerX: double -centerY: double -radius: double +getCenterX0: double +getCenterY0: double +getRadius0: double +draw0: void +animate0: void ClockEmoji FaceEmoji -hour: int -minute: int -isWinking: boolean +draw0: void +animate0: void +draw0: void +animate0: void SmileyFaceEmoji FrowingFaceEmoji +draw0: void +draw0: void

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

can you complete questions a , b , c , d .

Answered: 1 week ago