Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package CodeAcademy_6_Arrays_Functions_And_OOP;
- import java.util.Arrays;
- import java.util.Scanner;
- public class FlagDemo
- {
- public static void main(String[] args)
- {
- final String WHITE = "\033[39m";
- final String GREEN = "\033[31m";
- final String RED = "\033[32m";
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter the size of the flag : ");
- int size = scanner.nextInt();
- char[] row = new char[size];
- Arrays.fill(row, '\u2588');
- for (int i = 0; i < 3; i++) {
- String colour = new String(row);
- if (i == 0) {
- System.out.printf("%s%s %n", WHITE, colour);
- }
- else if (i == 1) {
- System.out.printf("%s%s %n", GREEN, colour);
- }
- else {
- System.out.printf("%s%s %n", RED, colour);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement