Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAMMING Below is a completed code the prints stairs with stick figures on each step. Rewrite this code by removing the man methods and

JAVA PROGRAMMING

Below is a completed code the prints stairs with stick figures on each step. Rewrite this code by removing the "man" methods and incorporating the stick figure into one of the other methods. Do not remove the COUNT value, or do anything that will change the output of the program. Simply remove the man method and make one of the other methods draw the stick figure on each step.

CODE

public class ProgrammingAssignment1 {

public static int COUNT = 5;

public static void main(String[] args) {

man2();

}

public static void man() {

System.out.println(" 0 ******");

System.out.println("/|\\ *");

System.out.println("/ \\ *");

}

public static void print_tabs(int n) {

for (int i = n - 1; i >= 0; i--)

System.out.print("\t");

}

// prints end of stairway on extra long first line

public static void print_first_closer(int n) {

// n + 1 because base of stairs

print_closer(n + 1);

}

// prints end of stairway on normal line

public static void print_closer(int n) {

//

for (int i = COUNT - n; i >= 0; i--)

System.out.print(" ");

System.out.println("*");

}

// prints a man on a staircase

public static void man2() {

for (int i = COUNT; i > 0; --i) {

print_tabs(i);

System.out.print(" 0 *****");

print_first_closer(i);

print_tabs(i);

System.out.print("/|\\ *");

print_closer(i);

print_tabs(i);

System.out.print("/ \\ *");

print_closer(i);

}

}

}

OUTPUT (DO NOT CHANGE)

0 *******

/|\ * *

/ \ * *

0 ****** *

/|\ * *

/ \ * *

0 ****** *

/|\ * *

/ \ * *

0 ****** *

/|\ * *

/ \ * *

0 ****** *

/|\ * *

/ \ * *

0 ****** *

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

Discuss the history of human resource management (HRM).

Answered: 1 week ago