Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Summary The purpose of this assignment is to construct two separate Java programs that produce three distinct levels or boards similar to those found in

Summary
The purpose of this assignment is to construct two separate Java programs that produce three distinct
levels or boards similar to those found in the Super Mario Brothers brand of games. These Java
programs will rely on method calls to reduce redundancy in your software. Additionally, you will get to
know the website tools and submission procedure to use for future homework.
Work Items
(1) In lab, you should have already installed the Java JDK and the BlueJ IDE on your home computer.
If you have not yet done so, please do so, as you will need both in order to do this homework.
(If you dont want to use BlueJ, you dont have to; feel free to use any programming
environment you wish. But Ill be using BlueJ much of the time in lecture.)
(2) Draw a flow chart of your second program (On Page #5). That is to say, create a flow chart of
only the contents of the runProgramTwo method (as named below in item 3d). You can treat
methods called in the runProgramTwo method as black boxes (i.e., you dont have to draw
flow charts for those sub-methods). Submit the image file of a scan of this flow chart:
a. The chart may be handwritten and can be more than one page. Please make it legible.
b. Your image file can be PDF, JPG, TIF, or PNG.
c. Please submit only one image file via Canvas. Do not email your instructor your work.
d. Name your file LastFirst_HW_Methods.pdf (or whatever is the extension for the graphic
format youre using), where you put in your own last name and first name for Last and
First. You must name your file this way.
(3) Write the two programs described below. Submit the single Java file (i.e.,.java text file) that
contains your two programs:
a. Please submit only a single Java file via Canvas (below I describe how you put two
programs into one file). Do not email your instructor your work.
b. Name your Java file LastName_FirstInitial_HW_Methods.java, where you put in your
own last name and first name for Last and First. You must name your file this way.
c. Note that by requiring you name your Java file LastFirst_HW_Methods.java, it means
that the public class that is in that file has to be named LastFirst_HW_Methods (again,
substituting your own name as appropriate). Note, in general you wouldnt put your
name in the class name (and thus filename), but in this course, it will simplify things for
the grader.
d. Each of your programs should be called by a method. Those methods should be written
in the same class as your program. Your Java file should have a main method that calls
these two methods. You probably will have a main method that looks like this:
Homework: Methods CSS142: Computer Programming I
CSS, University of Washington, Bothell 2
public static void main(String[] args)
{
runProgramOne();
runProgramTwo();
}
Context
Lets consider how we might represent a level from the game Super Mario Bros using just the symbols
on a keyboard. Specifically, look at the level design for the first board, and lets see if we can recreate
some of the patterns we observe below.
(1) We could model the ground with a minus sign, equal sign, or an underscore:
===================================================================
(2) Next we could add some ? boxes to our level (some of the coin and powerup boxes seen
between the bricks in the beginning of the level) along with bricks (denoted by the | sign):
|?|
|||||||||||||
|||?|||?||||||?|||
======================================================================================
(3) To make our task simpler here, were going to rotate our perspective 90 degrees so that we view
the board top-down instead of left-to-right. Just think of this as an exercise in changing your
culturally adopted reading style. Some cultures read left-to-right as you are doing now, and
some read top-to-bottom; can you think of any languages that are represented differently than
this? Either way lets ....
R
o
t
a
t
e
Homework: Methods CSS142: Computer Programming I
CSS, University of Washington, Bothell 3
Introduction
Your task is to write a program that outputs two distinct levels or boards from a Mario game. Your level
will be constructed from multiple smaller segments that you will string together by calling the correct
functions from your main function (remember, the terms method and function, for our purposes,
are interchangeable). Here is an example Mario level (note that some parts of the board are duplicates
use methods for all segments to avoid duplicate code):
||
||
||
||
||//segment1
||
||
|||?|
||
||//segment2
|||?|
||
||
||||
||||||
||||||||
||||||||||//segment3
||||||||||||
||
||^
|----------------
Note that by changing our perspective, the | character now represents the ground while the hyphen
represents vertical towers or other vertical structures (that are not the ground). The text that kind of
hovers in the air, e.g.,//segment2, are comment lines that indicate the portion to the left can be
thought of as a unit or chunk o

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_2

Step: 3

blur-text-image_3

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

Contemporary Issues In Database Design And Information Systems Development

Authors: Keng Siau

1st Edition

1599042894, 978-1599042893

More Books

Students also viewed these Databases questions

Question

What is a verb?

Answered: 1 week ago

Question

Was there an effort to involve the appropriate people?

Answered: 1 week ago