Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone help me to create a small program in which I can create star designs

ID: 3623760 • Letter: C

Question

Can someone help me to create a small program in which I can create star designs according to the user input. This have to be done with loops because it has to show that if the user first hits A , and then he inputs 3 for the number of rows then the design is:

*
**
***

if the design inputs B and then, lets say 4 for the number of rows the design will be:
****
***
**
*

If the user inputs c and then, any number (lets say 5) for the numbers of rows the output is.

*
**
***
****
*****

Finally in the case that the user inputs d and then lets say 4 the output is:

****
***
**
*

If the user inputs x then the program will end the loop

Explanation / Answer

import java.io.*; public class StarDesign { public static void main(String args[]) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s; char ch=' '; do { System.out.print("enter ur choice: "); s=br.readLine(); s=s.toLowerCase(); ch=s.charAt(0); switch(ch) { case 'a': for(int i=1;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote