Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA: I have provided the code for question 2 which is done, but now I need to modify it like question 4. Please help.

IN JAVA: I have provided the code for question 2 which is done, but now I need to modify it like question 4. Please help.

import java.util.Scanner;

public class Traingle {

public static void main(String[] args) {

// TODO Auto-generated method stub

// FOR INPUT

Scanner sc = new Scanner(System.in);

int n;

// prompting

System.out.println("Enter non-positive number to quit:");

while(true)

{

// taking user input

n = sc.nextInt();

// condition to continue

if(n>0)

{

// for number of lines

for(int i=1; i

{

// for stars in each line

for(int j=1; j

{

System.out.print("*");

}

System.out.println();

}

}

else

break;

}

}

}

image text in transcribedimage text in transcribed

D CentralLink I central Mic x(New Tab x/ Take Test: Lab g-For L001 C Secure https://black oardcmich.edu webapps assessmen take launch sp?course assessment id= 225021 1&course id= 14088/ 1&content id= 5601843 18 step-null ::: Apps Home! Central Mich zydentral Michigan Ur Fantasy Fontbll 201 e Home IChegg.com Hrowse My Compirer 3 points QUESTION 2 Create a program to ask user for an integer number and then draw a triangle with that size. You may construct a while or do-while loop to allow user enter number repeatedly. Draw a triange for each number entered. Terminate the program if user enter a non-positive number. Simulate the tollowing interaction. Please enter an integer number to draw a triangle Save Answer Enter non-positive number to quit: 10 Name your program Triangle and submit Triangle java Attach Flle Browse ly Computer QUESTION 3 O Type here to search 11:10 AM 3/15/2018

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

More Books

Students also viewed these Databases questions

Question

Discuss the states of accounting

Answered: 1 week ago