he other screenshot is the code t

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Creating MountainScape is what the question needs, the other screenshot is the code that we have already and needed to modify to add MountainScape into the original code to get that "mountain" shape

class Landscape
{
private String terrainString;:
Landscape ()
{
terrainString
}
public void flat (int length0fFlatPortions)
{
for (int count = 0; count < lengthOfFlatPortions; count++)
{
terrainString +=
}
}
public void hill (int lengthofHillTop) {
terrainString += "/":
for (int count = 0; count < length0fHillTop; count++)
terrainString +=
terrainString += "\\":
}
public void print ) {
System. out. println(terrainString);
}
}
class test3
{
public static void main(String[] args)
{
Lands cape lands cape = new Landscape );
lands cape. flat(3);
lands cape. hi ll (4);
lands cape. flat (2)
lands cape. hill (3)
lands cape. flat(4)
lands cape. hill (0);
lands cape. flat (1);
landscape. print ();
}
Transcribed Image Text:class Landscape { private String terrainString;: Landscape () { terrainString } public void flat (int length0fFlatPortions) { for (int count = 0; count < lengthOfFlatPortions; count++) { terrainString += } } public void hill (int lengthofHillTop) { terrainString += "/": for (int count = 0; count < length0fHillTop; count++) terrainString += terrainString += "\\": } public void print ) { System. out. println(terrainString); } } class test3 { public static void main(String[] args) { Lands cape lands cape = new Landscape ); lands cape. flat(3); lands cape. hi ll (4); lands cape. flat (2) lands cape. hill (3) lands cape. flat(4) lands cape. hill (0); lands cape. flat (1); landscape. print (); }
For problem 2 create a new class called MountainScape that has not only the flat () and hill () methods but also a
mountain () method. The output will now represent three lines of output text. Specifically, modify the code so that the following
build script will produce the output shown.
= new MountainScape ();
MountainScape mountainscape
//BUILD SCRIPT
mountainscape.flat (3);
mountainscape.mountain (3);
mountainscape.flat (2);
mountainscape.mountain (0);
mountainscape.flat (4);
mountainscape.hill (1);
mountainscape.flat (1);
//END SCRIPT
mountainscape.print ();
Output:
Transcribed Image Text:For problem 2 create a new class called MountainScape that has not only the flat () and hill () methods but also a mountain () method. The output will now represent three lines of output text. Specifically, modify the code so that the following build script will produce the output shown. = new MountainScape (); MountainScape mountainscape //BUILD SCRIPT mountainscape.flat (3); mountainscape.mountain (3); mountainscape.flat (2); mountainscape.mountain (0); mountainscape.flat (4); mountainscape.hill (1); mountainscape.flat (1); //END SCRIPT mountainscape.print (); Output:
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Processes of 3D Graphics
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education