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
Among the many DTP software tools available today, which is regarded as the industry standard for DTP?
nexus9112 [7]

Answer:

bland1 InDesign    Blank2 typesetting

Explanation:

4 0
3 years ago
Read 2 more answers
When you are saving a file, what does word suggest by default as the name of the document?
LenaWriter [7]
Whatever you have written on the page is what it'll name it.
5 0
3 years ago
Read 2 more answers
This OS was created by a developer named Torvalds.
GREYUIT [131]
The answer to this problem is Linux
7 0
3 years ago
WHAT is an UX designer? an interactive designer ? a front-end developer ? and what they do?
MatroZZZ [7]
Basically, it is an idea that has numerous measurements, and it incorporates a group of various controls, for example, cooperation outline, data construction modeling, visual configuration, convenience, and human-PC connection.

Answer: an interactive designer.


What they do?

It's about improving the experience that individuals have while communicating with your item, and ensuring they find esteem in what you're giving.



3 0
3 years ago
____ is (are) the abuse of e-mail systems to send unsolicited e-mail to large numbers of people.
Volgvan
Pretty sure answer is <span>E-mail spam</span>
4 0
2 years ago
Other questions:
  • Which key removes all data from an active cell with one click? A. Esc B. Delete C. Tab D. F2
    9·2 answers
  • What are examples of some Exotic currencies?
    14·1 answer
  • What Windows Server 2016 feature leverages the storage contained on a network of servers and adds a new level of fault tolerance
    14·1 answer
  • Access Control can be defined as putting controls (or countermeasures) in place to help achieve information security goals. Whic
    13·2 answers
  • What is a traffic controller?what are its functions?
    13·1 answer
  • Match the component to its function. resistor inductor capacitor battery transistor This component stores a temporary charge. ar
    7·2 answers
  • Give a detailed example of how an app (that you use regularly)uses parameters. You must state the app's name and function, the p
    7·1 answer
  • Write a method named printGPA that takes in as a parameter a Scanner to read in user input, and calculates a student's grade poi
    8·1 answer
  • What approach do you prefer to take when creating presentations for class projects? Would you rather use software or create pres
    12·2 answers
  • Capstone Project part 11 quiz
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!