Develop a complete java program that produces a square pattern of asterisks and spaces. First prompt the user for the size of the pattern, then use for loops to print out the pattern. If the user enters a value that is not a number your program's behavior is arbitrary. For non-positive values your program should print nothing and end normally. Your program should work for input values up to the width of the terminal window. Examples for the first 6 values are shown below.
Everytime i do the code i get full boxes. I can't seem to figure out how to make them hollow. Question is how is the program supposed to look.
Input: | 1 | 2 | 3 | 4 | 5 |
6 |
Output: |
* |
** ** |
*** * * *** |
**** * * * * **** |
***** * * * * * * ***** |
****** * * * * * * * * ****** |
import java.util.Scanner; public class AsterisksBox { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); for(int i = 0; i < n; ++i) { for(int j = 0; j < n; ++j) { if(i == 0 || j == 0 || i == n-1 || j == n-1) { System.out.print("*"); } else { System.out.print(" "); } } System.out.println(); } } }
Develop a complete java program that produces a square pattern of asterisks and spaces. First prompt...
PLEASE READ THE FULL INSTRUCTION.
Write a Java programme to print the pattern of asterisks shown below. For i=1 For i=2 * * For i=3 For i=n ** * ** ** ......... * (n asterisks) Your program should prompt the user to enter the value of n and then draw the corresponding star pattern. Remember if n is 5, you will have to print five patterns for i=1, i=2, i=3, i=4, and i=5. If n is 3, you will have...
Complete the Python program below that performs the following operations. First prompt the user to input two integers, n and m. If n<m, then print the odd positive integers that are less than m (in order, on a single line, separated by spaces). If man, then print the even positive integers that are less than n (in order, on a single line, separated by spaces). If neem, then print nothing. For instance, if the user enters 5 followed by 10,...
For this lab you will write a small program that prints a few "shapes" using asterisks. Your program will prompt the user to select a shape by entering a number (square or triangle for B grade, add the zig- zag for the A grade). It will then prompt for the size, and then if a square or triangle is selected it will prompt for "not filled" or "filled", and if azig-zag is selected it will prompt for the number of...
Hello Guys. I need help with this its in java In this project you will implement a Java program that will print several shapes and patterns according to uses input. This program will allow the use to select the type (say, rectangle, triangle, or diamond), the size and the fill character for a shape. All operations will be performed based on the user input which will respond to a dynamic menu that will be presented. Specifically, the menu will guide...
PYTHON CODING
Create a program that prompts the user twice. The first prompt should ask for the user's most challenging course at Wilmington University. The second prompt should ask for the user's second most challenging course. The red boxes indicate the input from the user. Your program should respond with two copies of an enthusiastic comment about both courses. Be sure to include the input provided by the user to display the message. There are many ways to display a...
java
Fill in the blanks to complete the following recursive program. It shou print a pattern like the one below. using System.out.println. Assume you have method String nspaces(n) which returns a string containing n spaces. You should not write nspaces.) The pattern below is of size 3. The first line has one space before the while the middle line has 3 spaces before the .. The program should work for any positive size. 3 public static gt ( if( }...
for python-3 I want to prompt the user to enter their first name and then Call the is_field_blank function to see if nothing was entered.and If nothing was entered i want it to display the following message "First Name must be Entered" and then re-prompt the user to enter the first name. I want it to do this repeatedly until the user enters a first name. this is what i have so far def main(): yourFirst = input("What is...
Write a program that will loop ten times. In each iteration prompt user to enter an integer between -50&50. Print the input, keep a running sum of the inputs, and track the minimun and maximum numbers input. After the loop is complete, minimum number entered, maximum number entered, sum of all numberes entered, and average of all numbers entered. Format all output. Before running the loop, print the label "Input values: ". Within the loop, print value entered by user...
PYTHON Fractal Drawing We will draw a recursively defined picture in this program. Create a function def fractal(length, spaces). This function will print out a certain number of stars * and spaces. If length is 1 print out the number of spaces given followed by 1 star. If the length is greater than one do the following: Print the fractal pattern with half the length and the same number of spaces. Print the number of spaces given followed by length...
In Java, please write the program for the following program.
Please TEST YOUR PROGRAM. You MUST use GUI, that means all user
input must be through the windows. The "first window" is the window
on the top left of the following picture. Add 5 more items to be
purchased. Search is accessed from second window, top right. Thw
third window is the bottom left, and the fourth window is the
bottom right. The program MUST CONTAIN EVERYTHING IN THE PICTURES....