Question: Programming assignment no.5 using netbeans, in java. having trouble drawing a box and a diamond. need help please. The IO class im using for the
Programming assignment no.5 using netbeans, in java. having trouble drawing a box and a diamond. need help please.
The IO class im using for the progam..
Here is what i have so far for program no.5
Programming Assignment No. 5 write a program that asks the user to enter a positive odd number less than 20. If the number is 5 15, you will a draw a diamond with the width the same as the number entered, if 3, 9, or 17, draw a box (a box is a hollowed out square) with the width the same as the number entered, otherwise draw a vertical line with the height the same as the number entered. Write a method for the diamond that accepts an integer as a and returns a string (use a while the same for the box( use a for loop) the vertical line. No output should be done in those methods. Write a method that will ask for the number and does not return until the number entered satisfies the conditions above. Use a do while loop in that method. Use a switch statement to determine which shape to draw. Use the methods from the lo class for input and output. Modify showMessage so that it uses a fixed-width font. Good program structure and indentation are required. public class Example f public result drawsquare int ni ring for int i 0; i n; i++) or, Cint j 0; j n; j++) result result+ "An" return result public static void main(stringCJ args) int input input. nextInt enter an odd integer 20" choice switch (choice case 13: Case 7: break Cdrawsquare choice)," square"); System exit (0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
