Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java The objective is to print a parallelogram based off the user's input of the height, width and character. I've figured out how to input

Java

The objective is to print a parallelogram based off the user's input of the height, width and character. I've figured out how to input the height, width and character, where I'm struggling is figuring out how to print the shape

My code thus far:

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); Double height; Double width; String entry; System.out.println("Enter height: "); height = scan.nextDouble(); if (height < 2) { System.out.println("Invalid choice, number must be greater than 2 and less than 8"); System.out.println("Enter height: "); height = scan.nextDouble(); } if (height > 8) { System.out.println("Invalid choice, number must be greater than 2 or less than 8"); System.out.println("Enter height: "); height = scan.nextDouble(); } System.out.println("Enter width: "); width = scan.nextDouble(); if (width < 2) { System.out.println("Invalid choice, number must be greater than 2 or less than 8"); System.out.println("Enter width: "); width = scan.nextDouble(); } if (width > 8) { System.out.println("Invalid choice, number must be greater than 2 or less than 8"); System.out.println("Enter width: "); width = scan.nextDouble(); } System.out.println("Enter character: "); entry = scan.nextLine(); if (entry.matches("[A-Za-z0-9]+")) { } } } 

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

Step: 3

blur-text-image

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

In what ways can transitions be established? [LO-6]

Answered: 1 week ago

Question

Why might it be desirable to operate enterprise funds at a profit?

Answered: 1 week ago