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
Discuss the main characteristics of the database approach and how it differs from traditional file systems.
Firdavs [7]

The database system allows the creation of a single depository of information, which is updated periodically and which can be used simultaneously by many users, since this type of system allows the effective sharing of all data stored in its depository . In addition, this is a secure system and is very difficult to break into. This is because of the efficiency of the software used to maintain it. However, the use of these softwares can be a little complicated for users, in addition to requiring a high economic cost to obtain them.

The traditional file system, in turn, each user must obtain their own file related to the application they want to run. This may seem dull in comparison to the database, but it is advantageous as it does not require any spending on software, as it is simple and there are several cheap and efficient tools and editors on the market. However, this system is not so safe, it can cause isolation of data and even data inconsistency, which disrupts the entire system.

6 0
3 years ago
One of the newest electronic conveniences is the ________, which can serve as a credit card, a debit card, and even unlock doors
77julia77 [94]
Computer Chips. / SILICON. This is just an educated guess
7 0
3 years ago
A strong example of using keywords would be a. Using “good” to remember the word “hideous” c. Both of these b. Using “hide” to r
posledela

The answer to the question you have asked is <u><em>"B" . </em></u> Because if you really think about it, there is no possible way that "Good" can be a keyword of "Hideous".

6 0
3 years ago
2) List three (3) negative impact of Technology on society
Nataly [62]

Answer:

1. social media and mobile devices may lead to psychological.

2. They may contribute to more serious health conditions such as depression.

3. The overuse of technology may have a more significant impact on developing children and teenagers.

Explanation:

may this help you have a good day

5 0
3 years ago
When Clara accesses the programs and documents on her computer by way of icons, she is said to be employing
julsineya [31]
Your answer would be D, graphical user interface. Hope this helps!
5 0
3 years ago
Read 2 more answers
Other questions:
  • What is the binary answer to the binary number 100 added to the binary number 11?
    14·2 answers
  • Write a function swap that swaps the first and last elements of a list argument. Sample output with input: 'all,good,things,must
    10·2 answers
  • With a DUI charge on a driver’s record ______________.
    10·1 answer
  • Write a recursive function that returns true if the digits of a positive integer are in increasing order; otherwise, the functio
    15·1 answer
  • Does anyone know how to fix this???
    11·1 answer
  • I CANT DO SKIN MODS ON BRAWLHALLA RIGHT!!!! IM SO MADDDDDDDDDDD
    11·1 answer
  • A bubble starts by comparing the first item in the list to all the remaining items, and swaps where the first item is ____ a lat
    9·2 answers
  • In what ways can information be slanted in a news report? List at least five ways.
    5·2 answers
  • Why is it a good idea not to change the subject line when replying to a message?
    8·2 answers
  • What operating system do most users use?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!