ShmoopTube

Where Monty Python meets your 10th grade teacher.

Search Thousands of Shmoop Videos


AP Computer Science A Videos 108 videos

AP Computer Science 3.5 Classes and Objects
186 Views

AP Computer Science: Classes and Objects Drill 3, Problem 5. Which of the following is not an object?

AP Computer Science 3.4 Classes and Objects
176 Views

AP Computer Science: Classes and Objects Drill 3, Problem 4. Which of the following are objects?

AP Computer Science 4.1 Classes and Objects
174 Views

AP Computer Science 4.1 Classes and Objects. Which of the answers is the best definition of a postcondition?

See All

AP Computer Science 2.4 Program Development 5 Views


Share It!


Description:

Get ready to work with classes in Java. Don't worry. We've thrown some penguins in there to spice things up.

Language:
English Language

Transcript

00:04

Here's your shmoop du jour brought to you by nervous penguins [Penguins on a block of ice]

00:07

waddle they do in times of trouble all right you've been assigned to a project

00:11

in which you'll be writing a collection of classes in Java in order to model the

00:14

various species of penguins in the world today super classes penguin with a

00:18

hierarchy of subclasses organized by genus and species your class hierarchy

00:23

will be used to model penguins in zoos and wildlife preserves all over the [People photographing a penguin in a dress]

00:27

world the superclass penguin is declared as the following a subclass is to be

00:33

implemented for emperor penguins and a new data member will be added for the

00:37

age of the emperor penguin the emperor subclasses implemented as follows

00:42

alright well the print method for the Emperor subclasses intended to print the

00:46

same name information as the superclass print function and then print a

00:51

similarly labeled line for the age of the emperor penguin and return a new

00:54

line on the console for example.. For a 7 year old emperor penguin named Jane Fonda the [Jane Fonda penguin appears]

01:00

method should display the following on the console right there with the cursor

01:05

placed on a new line afterward which is a correct implementation for the

01:10

subclass print method and here are your potential answers.... alright well the

01:18

problem asked us to print the same info as the superclass penguin instead of [Photo of emperor penguin prints out]

01:22

rewriting an entire print function we can just use the keyword super to call

01:26

the super classes print function...Know this and we can eliminate all the potential

01:31

answers except for E... just to make sure this is our answer well let's check if

01:35

the rest of its correct the second line uses a print line to print out the word

01:39

age and the Emperor's age along with this the code moves the cursor to a new

01:44

line and yeah this is exactly what the question asked for so it looks like E [Penguins chase a cat]

01:48

is our answer next time we'll take a look at the penguin foot massage parlor [Penguins entering foot massage parlor]

01:53

happy feet

Related Videos

AP Computer Science 1.2 GridWorld Case Study and APIs
493 Views

AP Computer Science 1.2 GridWorld Case Study and APIs. What is the direction of the actor?

AP Computer Science 1.4 Standard Algorithms
200 Views

AP Computer Science 1.4 Standard Algorithms. How many times will mystery be called for mystery(n) for n > 1?

AP Computer Science 2.3 Classes and Objects
191 Views

AP Computer Science 2.3 Classes and Objects. Which of the following is correct implementation of the Country class?

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism
204 Views

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism. Which of the following will satisfy the conditional if statement for boo, str,...

AP Computer Science 4.2 Standard Algorithms
191 Views

AP Computer Science 4.2 Standard Algorithms. What kind of algorithm is the following?