[Solved] CmpE150 Project1

$25

File Name: CmpE150_Project1.zip
File Size: 150.72 KB

SKU: [Solved] CmpE150 Project1 Category: Tag:
5/5 - (1 vote)

You will write a Java program to implement the ASCII stickman climbing the stairs below using two parameters stickmanHeight as the height of the stickman and stairHeight as the height of the stairs. One example run is given below, other example outputs are provided as .txt files. Please read the assignment description and check out the example outputs before beginning to write any code. Example Run: stickmanHeight = 5, stairHeight = 2

O

/|

| ___|| | ___|***|

/ ___|******|

O

/|

|

| ___|| / ___|***|

___|******|

O

/|

|

|

/ ___||

___|***|

___|******|

Please make sure you follow these rules in your implementation:

  1. Your program should have at least two static methods in addition to your main method. Try

to write your program as modular as possible (without overusing methods).

  1. You are not allowed to generate the entire picture or any single line using printing statements such as System.out.print or System.out.println, with the exceptions:
    • The head of the stickman ( O ),
    • The arms and torso of the stickman (/|), and
    • The legs of the stickman (/ )

For example, you cannot have a statement that says:

System.out.println(___|***|);

It was intended to be generated using for loops.

  1. Assume that stickmanHeight will be greater than stairHeight +2. (In other words, stairHeight + 2 < stickmanHeight) Also, stairHeight will always be greater than or equal zero.
  2. You are not allowed to use statements that we havent learned in class as of 15/10/19 (such as while loops, arrays, if statements and so on).
  3. Try to minimize the number of for loops you use.
  4. We have given you a part of the code for the main method in arguments.java file. This code runs your program with arguments given to stickmanHeight and stairHeight

Copy this code to your own .java file. To test and run your program with arguments, click Run -> Run Configurations -> Arguments -> Program Arguments. Enter two integers here, and then click run at the bottom of the window. These two integers represent stickmanHeight and stairHeight respectively.

Implementation Details:

  • Think of the stickman as a rectangle with dimensions 3 x stickmanHeight. The parts with the head or just the torso ( | ) of the stickman should have one blank space around them.
  • Stairs are formed of 3 parts:
  1. The floor part which is fixed (___),
  2. The beginning and the end of the stair (||),
  3. The filling pattern between the beginning and the end of the stair (******).
  • The amount of blank spaces between the stickman and the stairs, and the filling pattern inside the stairs (the number of stars) are both multiples of 3. The amount of blank lines after a single frame is outputted is exactly 3.
  • The amount of blank lines at the beginning of each output frame is also important. Each frame should have the same total height, which has the relation stickmanHeight + stairHeight.
  • A frame is each printed pattern, like every single step the stickman takes. See the image below.
  • The appearance of the output and the values of parameters may be confusing, so interpret stickmanHeight and stairHeight as starting from the bottom of the figure and assume each line has height of 1 unit. For example, in the below example stickmanHeight = 5 and stairHeight is 2, not 3.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CmpE150 Project1
$25