CSS 142 University of Washington Seattle Campus Mario Boards Revision Methods Hello i wanted someone to revision and make this program less complex and i have uploaded the file and also what the homework should look like 2 files are what i have done and the other is what the homework needs.
And a final checklist of things to look at before you submit your work:
Remember you are turning in two files! (See the assignment description for details.) Please make sure any images are oriented so they are upright when opened.
Compile and execute your code before you submit the .java file. If it doesn’t work, something is wrong.
Check the extensions of the files you are submitting. The list of file types you can submit are given below.
Make sure both files start with “LastFirst”, i.e., your lastname then your firstname, with the first letter of each capitalized. If you do not do this, I cannot guarantee I’ll be able to properly credit you with creating a working program.
Limit the width of your code to 80 characters. This makes it easier for me to read.
Define variables mario and coin. What data type should they be? How might you use these variables?
Make methods in your code. These methods can all be part of the class that has the main method.
You shouldn’t need to use looping or branching, though, of course, you could if you wanted to. Unless you are already pretty comfortable with those constructs, I’d stick to doing this the more straightforward way.
If you’re using the BlueJ IDE, here is a quick review (Links to an external site.) of how to make it work:
Pay attention to the last sentence in that review that tells you how to clear the screen each time before you run your main method. Otherwise, successive screen writes will add onto previous writes.
In the same Options menu that controls clearing the screen, also select “Unlimited Buffering”. Otherwise, if your boards are long, all of them will not show on the screen.
Use Tab and Shift-Tab to quickly indent and deindent blocks of code Homework: Methods
CSS142: Computer Programming I
Homework: Methods Mario Boards
CSS 142: Computer Programming I
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. 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 LastFirst_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:
CSS, University of Washington, Bothell
1
Homework: Methods
CSS142: Computer Programming I
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
CSS, University of Washington, Bothell
2
Homework: Methods
CSS142: Computer Programming I
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 of the board. The syntax of that text follows the Java syntax for
comments. Your program should not write out //segment2 etc.
CSS, University of Washington, Bothell
3
Homework: Methods
CSS142: Computer Programming I
Your First Program
The first program will clone the output from above and create two different Mario boards. Call the first
Mario Board 1 and the second Mario Board 2. These two boards will be the same text for the
individual segments, but each will have unique look for due to the order and number of function calls in
your main function. For example, you could redesign the level above as a longer level while reusing the
same basic building blocks; here would be that output (which I preface by the label Mario Board 1),
again with the //segment1 etc. as labels to help you see the modularity of the board segments:
Mario Board 1:
||
||
||
||
||
||
||
||
||
||
||
||
||
||
||
||
||
||
//segment1
|?|
//segment2
|?|
|?|
//segment2 repeated
|?|
||
||
||
||
||
||
||
||||
||||||
||||||||
||||||||||
||||||||||||
||
||
^
|—————-
CSS, University of Washington, Bothell
//segment1 repeated
//segment3
4
Homework: Methods
CSS142: Computer Programming I
Your Second Program
This program is quite similar to the first, so you might consider making a copy of your first program as a
starting point for your second. In future weeks, well discuss better techniques for code reuse than
simply copying and pasting, but for this assignment, this is a fine way to shorten the work you have to
do. The goal of the second program is to ask the user for the unique text representation of the hero
Mario and of a coin; then your program will build a board and place Mario somewhere in it, as well as
one or more coins. To do the user input from the console (keyboard), you will want to use the Scanner
class. A sample execution of this program might look like:
CSS, University of Washington, Bothell
5
Homework: Methods
What does Mario Look like?
CSS142: Computer Programming I
>–
Purchase answer to see full
attachment
Consider the following information, and answer the question below. China and England are international trade…
The CPA is involved in many aspects of accounting and business. Let's discuss some other…
For your initial post, share your earliest memory of a laser. Compare and contrast your…
2. The Ajax Co. just decided to save $1,500 a month for the next five…
How to make an insertion sort to sort an array of c strings using the…
Assume the following Keynesian income-expenditure two-sector model: AD = Cp + Ip Cp = Co…