Building Java Programs: A Back To Basics Approach (5th Edition)
5th Edition
ISBN: 9780135471944
Author: Stuart Reges, Marty Stepp
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 9.3, Problem 16SCP
Program Plan Intro
Find output for the given code fragments
Program plan:
- Create a class “Pond”,
- Define the method “method1()” that prints the string “Pond 1”.
- Define the method “method2()” that prints the string “Pond 2”.
- Define the method “method3()” that prints the string “Pond 3”.
- Create a class “Lake” that extends the super class “Pond”,
- Define the method “method3()”,
- Print the string “Lake 3 ”.
- Call the method “method2()”.
- Define the method “method3()”,
- Create a class “Bay” that extends the super class “Lake”,
- Define the method “method1()”,
- Print the string “Bay 1 ”.
- Call the method “method2()” of super class.
- Define the method “method2()”,
- Print the string “Bay 2 ”.
- Define the method “method2()”,
- Define the method “method1()”,
- Create a class “Ocean” that extends the super class “Bay”,
- Define the method “method2()”,
- Print the string “Ocean 2 ”.
- Define the method “main()”,
- Create array object for the class “Pond”.
- Execute loop,
-
- Call the method “method1()”.
- Print new line.
- Call the method “method2()”.
- Print new line.
- Call the method “method3()”.
- Print new line.
- Define the method “main()”,
- Print the string “Ocean 2 ”.
- Define the method “method2()”,
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionChapter 9 Solutions
Building Java Programs: A Back To Basics Approach (5th Edition)
Ch. 9.1 - Prob. 1SCPCh. 9.1 - Prob. 2SCPCh. 9.1 - Prob. 3SCPCh. 9.2 - Prob. 4SCPCh. 9.2 - Prob. 5SCPCh. 9.2 - Write a constructor for the UndergraduateStudent...Ch. 9.2 - Prob. 7SCPCh. 9.2 - Prob. 8SCPCh. 9.2 - Suppose the Truck code from the previous problem...Ch. 9.3 - Consider the following classes:
public class...
Ch. 9.3 - Using the A, B, C, and D classes from this...Ch. 9.3 - Assume that the following classes have been...Ch. 9.3 -
Using the classes from the previous problem,...Ch. 9.3 - Prob. 14SCPCh. 9.3 - Prob. 15SCPCh. 9.3 - Prob. 16SCPCh. 9.3 - Prob. 17SCPCh. 9.4 - What is the difference between an is-a and a has-a...Ch. 9.4 - Prob. 19SCPCh. 9.4 - Prob. 20SCPCh. 9.4 - Prob. 21SCPCh. 9.5 - Prob. 22SCPCh. 9.5 - Prob. 23SCPCh. 9.5 - Prob. 24SCPCh. 9.5 - Prob. 25SCPCh. 9.5 - Prob. 26SCPCh. 9.6 - What is an abstract class? How is an abstract...Ch. 9.6 - Prob. 28SCPCh. 9.6 - Consider writing a program to be used to manage a...Ch. 9 - Prob. 1ECh. 9 -
Write a class Janitor to accompany the other law...Ch. 9 - Write a class HarvardLawyer to accompany the other...Ch. 9 - Write a class MonsterTruck that relates to the Car...Ch. 9 - Prob. 6ECh. 9 - Prob. 9ECh. 9 -
FilteredAccount. A cash processing company has a...Ch. 9 - Add an equals method to the TimeSpan class...Ch. 9 - Add an equals method to the Cash class introduced...Ch. 9 -
Write a class named Octagon whose objects...Ch. 9 -
Write a class named Hexagon whose objects...Ch. 9 -
Write a class named Dodecagon whose objects...Ch. 9 -
Declare an interface called Incrementable which...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY