Patterns.java - import [email protected]

This preview shows page 1 - 2 out of 2 pages.

import java.util.Scanner; /** * @author devyn * @version 10/6/2020 */ public class Patterns { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String pattern; int input; int times = 0; int colums = 0; int stairs = 0; System.out.println("Enter pattern:"); pattern = sc.next(); if (pattern.equals("H")) { System.out.println("Enter a positive integer between 1 and 10 inclusive:"); input = sc.nextInt(); for (times = 0; times < input; times++) { System.out.print("*"); } } else if (pattern.equals("V")) { System.out.println("Enter a positive integer between 1 and 10 inclusive:"); input = sc.nextInt(); for (times = 0; times < input; times++) { System.out.println("*"); } } else if (pattern.equals("S")) { System.out.println("Enter a positive integer between 1 and 10 inclusive:"); input = sc.nextInt();

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture