1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ss7ja [257]
3 years ago
6

3) Write a program named Full_XmasTree using a nested for loop that will generate the exact output. This program MUST use (ONLY)

for loops to display the output below. For example the 1st row prints 1 star 2nd row prints 2, the 3rd row print 3 stars and so forth... This program is controlled by the user to input for the amount of row. "Prompt the user to enter the dimensions of the tree" A good test condition is the value of ten rows. (hint***)This program should account for white spaces print("* "). Remember the purpose of print() and println()

Computers and Technology
1 answer:
N76 [4]3 years ago
8 0

Answer:

Following are the code to this question:

//import package

import java.util.*;  

public class Full_XmasTree   //defining class

{        

// defining main method

public static void main(String as[])  

   {  

       int X,a,b; //defining integer variable

       Scanner obx = new Scanner(System.in); // creating Scanner class object

       System.out.print("Please enter: "); //print message

       X = obx.nextInt(); // input value from user

       for (a = 0; a < X; a++) //defining loop to print pattern  

       {

           for (b = X - a; b > 1; b--)//use loop for print white space  

           {

           System.out.print(" ");//print space

           }

           for (b = 0; b <= a; b++) // use loop to print values  

           {

               System.out.print("* "); //print asterisk values

           }

           System.out.println(); //using print method for new line

       }

   }

}

Output:

please find the attachment.

Explanation:

In the given java code, a class "Full_XmasTree" is declared, in which the main method is declared, inside this method three integer variable "X, a, and b", in this variables "a and b" is used in a loop, and variable X is used for user input.

  • In the next line, the Scanner class object is created, which takes input in variable X, and for loop is used to print asterisk triangle.
  • In the first for loop, use variable a to count from user input value, inside the loop, two for loop is used, in which first is used to print white space and second is used for the print pattern.

You might be interested in
Define a function that will return the length of a list
Alexus [3.1K]

Answer:

len()function:

Explanation:

that's for python btw

i also know java if you want a java version

3 0
2 years ago
The purpose of the trusted platform module is:
Elza [17]
A Trusted Platform Module is a specialized chip on an endpoint device that stores RSA encryption keys specific to the host system for hardware authentication. Each TPM chip contains an RSA key pair called the Endorsement Key. The pair is maintained inside the chip and cannot be accessed by software.
6 0
2 years ago
Read 2 more answers
There are 22 gloves in a drawer: 5 pairs of red gloves, 4 pairs of yellow, and 2 pairs of green. You select the gloves in the da
AVprozaik [17]

Answer:

Best-case = 2 gloves

Worst-case = 12 gloves

Explanation:

  • For the best-case: Because there is a chance that you take two gloves of the same color in the first two round the answer is two.
  • For the worst-case: The worst case would be if, for each color-group of gloves you take the right or left glove, for example, you take 5 left-hand red gloves then 4 left-hand yellow gloves, then 2 left-hand green gloves, because you have already taken all of the left gloves the next one is going to be a right glove that is going to pair with one of the already selected gloves, therefore, the answer is 12 -> 5+4+2+1 = 12
3 0
3 years ago
What kinds of dogs are there
drek231 [11]
There are al types of dogs what specific breed are you looking for

5 0
3 years ago
Read 2 more answers
Why are people's visions of utopias and dystopias subjective?
Leno4ka [110]

Answer:

D. Because the technology needed for one person's utopia may be what creates disaster for another person's dystopia.

Explanation:

3 0
2 years ago
Other questions:
  • In internet terminology, what is the term, .com, called?
    12·2 answers
  • When enter a function or formula in a cell, which is the character you must type?
    14·1 answer
  • Employers will check you out on social media sites like Facebook, MySpace, and Twitter.
    6·2 answers
  • Can you use public domain images without violating copyright laws?
    5·1 answer
  • 1.2 Discuss each of the following terms: (a) data (b) database (c) database management system (d) database application program (
    12·1 answer
  • A(n) __ is a list of main points and sub-points of a topic to include in a presentation
    14·2 answers
  • Benching system are prohibited in
    5·1 answer
  • According to the government, employees have a right to understand the risks associated with the materials they work with.
    15·1 answer
  • Choose and explain, step by step, one method of backing up student files either manually or using a cloud service.
    10·1 answer
  • In which of the following phases of filmmaking would a production team be focused on the
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!