Question

Can I get some help with these please.

Can I get some help with these please.

Can I get some help with these please.


0 0
Add a comment Improve this question Transcribed image text
Answer #1

Run1:

===========================

Run2:

===========================

R Problems @ Javadoc 다 Declaration e console 、イSearch 拳Debug e Call H <terminated> Starts [Java Application] /opt/jdk1.7.0_21

Run3:

===========================

木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木 \\\\木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木木

=============================================

Program Starts.java

=============================================

import java.util.Scanner;

public class Starts {

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);
       int height;

       System.out.println("Enter Height: ");
       height = sc.nextInt();

       for (int i = 0; i < height; i++) {

           if (i == 0) {
               printForwardSlash((height - 1) * 8 / 2);
               printBackwordSlash((height - 1) * 8 / 2);
           } else {

               if ((i + 1) != height) {
                   printForwardSlash(((height - 1) * 8 - i * 8) / 2);
               }

               for (int j = 1; j <= i * 8; j++) {
                   System.out.print("*");
               }

               if ((i + 1) != height) {
                   printBackwordSlash(((height - 1) * 8 - i * 8) / 2);
               }

           }
           System.out.print("\n");
       }

   }

   public static void printForwardSlash(int n) {
       for (int i = 1; i <= n; i++) {
           System.out.print("/");
       }
   }

   public static void printBackwordSlash(int n) {
       for (int i = 1; i <= n; i++) {
           System.out.print("\\");
       }
   }

}

Add a comment
Know the answer?
Add Answer to:
Can I get some help with these please.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT