INPUT AND FORMATTED OUTPUT: RIGHT-FACING ARROW | USING NETBEANS | Angel Palacios

2 years ago
467

#InputAndFormattedOutputRightFacingArrow

LAB: INPUT AND FORMATTED OUTPUT: RIGHT-FACING ARROW

Given two input integers for an arrowhead and arrow body, print a right-facing arrow.

Ex: If the input is:

0 1

the output is:

1
11
00000111
000001111
00000111
11
1

Chapters:
0:00 Intro
0:11 Right-facing arrow
5:37 Output (Results)

SOLUTION: ** LabProgram.java **

import java.util.Scanner;

public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int baseChar;
int headChar;

baseChar = scnr.nextInt();
headChar = scnr.nextInt();

System.out.print(" ");
System.out.println(headChar);
System.out.print(" ");
System.out.print(headChar);
System.out.println(headChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(headChar);
System.out.print(headChar);
System.out.println(headChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(headChar);
System.out.print(headChar);
System.out.print(headChar);
System.out.println(headChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(baseChar);
System.out.print(headChar);
System.out.print(headChar);
System.out.println(headChar);
System.out.print(" ");
System.out.print(headChar);
System.out.println(headChar);
System.out.print(" ");
System.out.println(headChar);

}
}

Good luck and I hope this helps!

Thank you all for watching!

Music in this video
Music: Paradise and Harmony
Musician: @iksonmusic

Loading comments...