Write a Java program that prompts the user for an int n. You can assume that 1 ≤ n ≤ 9. Your program should use embedded for loops that produce the following output: 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 . . . n . . . 5 4 3 2 1 Your prompt to the user should be: Please enter a number 1...9 : Please note that your class should be named PatternTwo.

Answers

Answer 1

Answer:

Here is the JAVA program:

import java.util.Scanner;  // to take input from user

public class PatternTwo{   //class name

public static void main(String args[]){  //start of main function

Scanner scan = new Scanner(System.in);   // creates Scanner class object

System.out.print("Please enter a number: ");  //prompts user to enter an int n for the number of rows

int n = scan.nextInt();   //reads and scans the value of n from user

int i, j;   //declares two variables to iterate through i  rows and j columns

for (i=1; i<=n; i++){    //outer loop for rows  

for (j=2*(n-i); j>=1; j--){   //inner loop for space between numbers in pattern  

System.out.print(" ");  }   //displays an empty space in the pattern

for (j = i; j >= 1; j--)  { //inner loop for columns  

System.out.print(j+" "); }   //prints the value of j (prints numbers in reverse)

System.out.println();   }   }   }  //prints a new line after printing each row

Explanation:

The program is explained with an example in the attached document.

Write A Java Program That Prompts The User For An Int N. You Can Assume That 1 N 9. Your Program Should

Related Questions

What makes Java platform independent?

Answers

Answer:

Java it is the use of Byte code that makes it platform independent.

Explanation:

Java platform independent language allows its the end users to access they source code and other language automatically,its a human readable language.

Java is created in the James Gosling at the sun micro systems,and java is an open source programming language, generally the people refer the java because its source connections.Java code may be use sequence of machine that can be use executed by the directly CPU,and all the program in java are compiled by java c.Java is an independent platform and variety of methods, its object oriented language, and java is study platform.Java program are compiled into byte code and that byte code is platform independent, and they machine execute the byte code the java virtual machine.Java is the platform independent because it does not depend on the type of platform,and the virtual machine also interpret the representations.Java compiler is the .class file or the byte code and the machine native code,java is that depend on java virtual machine.Java is does not required any licence to the run and they also reliable platform to work on.

One of the simplest and best known polyalphabetic ciphers is _________ cipher. In this scheme, the set of related monoalphabetic substitution rules consists of the 26 Caesar ciphers with shifts of 0 through 25. Each cipher is denoted by a key letter which is the ciphertext letter that substitutes for the plaintext letter a.

Answers

Answer:

Vigenere

Explanation:

Vigenere Cipher is an encryption method of alphabetic symbols that utilizes an easy form of polyalphabetic exchange which is carried out through Vigenere table.

Hence, in this situation, the correct answer is VIGENERE Cipher because it is the form of cipher whereby the set of related monoalphabetic substitution rules comprises of the 26 Caesar ciphers with shifts of 0 through 25. Each cipher is indicated by a key letter which is the ciphertext letter that substitutes for the plaintext letter.

Which of the following statement about device formatting is FALSE?
A) Device manufacturers store the initial file-system data structures in the device.
B) Operating system can create multiple partitions with in a single device.
C) Volume creation is implicit when a file system is placed directly within a partition.
D) Not every partition contains a copy of the operating systems.

Answers

Answer:

The correct option is;

A) Device manufacturers store the initial file-system data structures in the device.

Explanation:

Before a storage device can be used for data storage, it is required to prepare the device for use and to make the device to become visible to the operating system by formatting of the device

New storage devices are not pre-formatted or come with a ready to use file system as there are different file systems specifically designed for particular  operating systems or operating environment.

Formatting creates partitions, makes the hard drive visible to the operating system and creates a file system that is new such that the storage device can be used for storing files.

What do you think is the single greatest physical threat to information systems? Fire? Hurricanes? Sabotage? Terrorism? Something else? Discuss this question and provide support for your answer.

Answers

Answer:

The single greatest physical threat to information systems is:

Sabotage

Explanation:

Sabotage describes the efforts of internal persons to ensure that a system does not operate as intended or is destroyed.  Among the threats to information systems, this is the greatest.  The problem with sabotage is that the operators are internal, they know the system very well.  They understand the weak points and the strengths of the system.  They are internal terrorists to any information system.  These internal saboteurs are capable of using any means to achieve their purpose.  Therefore, it is necessary to scrutinize employees from time to time to discover internal risks.

Clicking and double-clicking are two of the five

Answers

Answer:

The correct answer is events

How can you say that a computer is a versatile machine?​

Answers

Answer:

A computer is a versatile machine because is used for many purposes,a modern day computer can run multiple data at once making a fast and efficient machine very durable and effective for our use in all areas of life.

Students who respond promptly to e-mails are following which netiquette rule?

A. keeping content appropriate
B. assessing an online environment
C. respecting everyone’s time
D. practicing ethical behaviors

Answers

Answer:

respecting everyone's time

Explanation:

they don't make people wait for a response

Its Option C - Respecting Everyone’s Time.
Thank you!

C++ code pls write the code

Answers

Answer:

Following are the code to this question:

#include<iostream>//defining header file

using namespace std;

class vec//defining class vec  

{

int x, y, z; //defining integer varaible x, y, z

public: // using public access specifier

vec() //defining default constructor

{

   x = 0; //assign value 0 in x variable  

   y = 0; //assign value 0 in y variable

   z = 0;//assign value 0 in z variable

}

vec(int a, int b , int c) //defining parameterized constructor vec

{

   x = a; //assign value a in x variable

   y = b; //assign value b in y variable

   z = c;//assign value c in z variable

}

void printVec() //defining a method printVec

{

   cout<<x<<","<<y<<","<<z<<endl; //use print method to print integer variable value

}

//code

vec& operator=(const vec& ob) //defining operator method that create object "ob" in parameter  

{

x=ob.x; //use ob to hold x variable value

y=ob.y;//use ob to hold y variable value

z=ob.z;//use ob to hold z variable value

return *this;//using this keyword to return value  

}

};

int main()//defining main method

{

vec v(1,2,3);//calling parameterized constructor

vec v2; //creating class object to call method

v2=v; //creatring reference of object

v2.printVec(); //call method printVec

return 0;

}

Output:

1, 2, 3

Explanation:

In the above-given code part, a method "operator" is defined, that accepts an object or we can say that it is a reference of the class "ob", which is a constant type. Inside the method, the object is used to store the integer variable value in its variable and use the return keyword with this point keyword to return its value.    

_______tools enable people to connect and exchange ideas.A) Affective computing. B) Social media. C) Debugging D) Computer forensics.

Answers

Answer:

B) Social media.

Explanation:

Social media is well, a media, that allows you to share things with people and have discussions.

Write a program that performs the following tasks: Display a friendly greeting to the user Prompt the user for the value to convert (a String) Accept that String Prompt the user for the value of the initial base (an integer) Accept that integer Prompt the user for the desired base of the output (an integer) Accept that integer If the String is not a legal expression of a number in the initial base, display an error message and exit the program. Convert the value represented by the String in the initial base to the desired base. Display the result.

Answers

Explanation:

import java.util.Scanner;

import java.math.BigInteger;

public class Main

{

private int x;  

public static boolean isValidInteger(String theValue, int theBase)

{    

BigInteger number = new BigInteger(theValue,theBase);

if(theValue.equals(number.toString(theBase)))

{

return true;

}

else

return false;

}

public static String convertInteger(String theValue, int initialBase, int finalBase)

{

boolean valid=isValidInteger(theValue,initialBase);

if(valid==true)

{

BigInteger number = new BigInteger(theValue);

return(number.toString(finalBase));

}

else

return("String not in initial base");  

}

public static void main(String[] args)

{

System.out.println("Welcome");

String value;

int ibase, dbase;

if(args.length==0)

{

Scanner S = new Scanner(System.in);

System.out.println("Enter Value to be converted :: ");

value = S.nextLine();

System.out.println("Enter initial base :: ");

ibase = S.nextInt();

System.out.println("Enter desired base :: ");

dbase = S.nextInt();

}

else

{

value=args[0];

ibase=Integer.parseInt(args[1]);

dbase=Integer.parseInt(args[2]);

}

  System.out.println("Change base "+convertInteger(value,ibase,dbase));  

}

}

Output

if you exit a program without saving the document on which you are working, or the computer accidentally losses electrical power, the document will be lost

Answers

Depends on which program you are using. Some programs automatically save your work, even if you exit out of it or turn off your computer

An ISP is considering adding additional redundant connections to its network. Which of the following best describes why the company would choose to do so?

Answers

Answer:

Redundant networks are generally more reliable.

Explanation:

The complete question is in this brainly link;

https://brainly.com/question/18302186

This is based on knowing the importance of a redundant network.

C. Redundant networks are more reliable

A redundant network is one that helps to increase the reliability of a computer system.

Now, this is possible because the more critical the ISP NETWORK is, the more important it will be for the time it takes to resolve from a fault would be reduced.

This implies that, by adding one redundant device to their connection, the time it will take to resolve from a fault would be drastically reduced and this will lead to a far more reliable system.

Thus, redundant networks are more reliable.

Read more at; brainly.com/question/17878589

Web pages are accessed through a software program called a _____.A) ​web crawlerB) ​web browserC) ​web serverD) ​web app drawer

Answers

Answer: B) ​web browser

Explanation: A web browser may be explained as a software program or application available on various operating systems such as windows, Mac, Android, iOS among others. This program acts as an interface between information available on websites or pages and users. This application takes a specified uniform resource locator or web address as input and outputs the information available on a web page. Google Chrome, Internet Explorer, Microsoft edge, opera mini, Safari, Firefox and so on.

Research and a well-written problem statement are important because A)they give a clear understanding of the problem and its solution. B)they ensure that anyone in the general public will be able to understand and solve the problem. C)they give a list of the needs of the stakeholders. D)they ensure that questions still need to be asked about the problem.

Answers

Answer:

A. they give a clear understanding of the problem and it's solution

Explanation:

Research and a well-written problem statement are important because they give a clear understanding of the problem and its solution.

Answer:

Research and a well-written problem statement are important because

they give a clear understanding of the problem and its solution.

they ensure that anyone in the general public will be able to understand and solve the problem.

they give a list of the needs of the stakeholders.

they ensure that questions still need to be asked about the problem.

How has technology influenced space exploration?

Answers

Answer:

One of the biggest benefits of machine learning when it comes to space exploration is that programs can sift through the available data more easily than humans, which increases the chance of finding planets just by looking at datasets. It's even thought that AI could be instrumental in locating extra-terrestrial life.

Explanation:

Why do I have two random warnings?

Answers

Just a guess, maybe you’ve been reported for having an incorrect answer two times? I’m really not sure I’m just trying to give out possibilities. Maybe if your a Brainly Helper you haven’t been active so they are giving you warnings? Does clicking on the warning tell you the reason for them? Maybe the system thinks your a robot? I’m not sure just trying to give possible reasons, but you could try contacting customer support, but they aren’t always the quickest at responding.

Have a good day!

Answer:

bc of katie

Explanation:

Write a program that prompts the user to input an integer that represents the money in cents. The program will the calculate the smallest combination of coins that the user has. For example, 42 cents is 1 quarter, 1 dime, 1 nickel, and 2 pennies. Similarly, 49 cents is 1 quarter, 2 dimes, and 4 pennies

Answers

Answer:

The program in Python is as follows:

cents = int(input("Cent: "))

quarter = int(cents/25)

if quarter > 1:

     print(str(quarter)+" quarters")

elif quarter == 1:

     print(str(quarter)+" quarter")

cents = cents - quarter * 25

dime = int(cents/10)

if dime>1:

     print(str(dime)+" dimes")

elif dime == 1:

     print(str(dime)+" dime")

cents = cents - dime * 10

nickel = int(cents/5)

if nickel > 1:

     print(str(nickel)+" nickels")

elif nickel == 1:

     print(str(nickel)+" nickel")

penny = cents - nickel * 5

if penny > 1:

     print(str(penny)+" pennies")

elif penny == 1:

     print(str(penny)+" penny")

Explanation:

This line prompts user for input in cents

cents = int(input("Cent: "))

This line calculates the number of quarters in the input amount

quarter = int(cents/25)

This following if statement prints the calculated quarters

if quarter > 1:

     print(str(quarter)+" quarters")

elif quarter == 1:

     print(str(quarter)+" quarter")

cents = cents - quarter * 25

This line calculates the number of dime in the input amount

dime = int(cents/10)

This following if statement prints the calculated dime

if dime>1:

     print(str(dime)+" dimes")

elif dime == 1:

     print(str(dime)+" dime")

cents = cents - dime * 10

This line calculates the number of nickels in the input amount

nickel = int(cents/5)

This following if statement prints the calculated nickels

if nickel > 1:

     print(str(nickel)+" nickels")

elif nickel == 1:

     print(str(nickel)+" nickel")

This line calculates the number of pennies in the input amount

penny = cents - nickel * 5

This following if statement prints the calculated pennies

if penny > 1:

     print(str(penny)+" pennies")

elif penny == 1:

     print(str(penny)+" penny")

Discuss the main characteristics of the database approach and how it differs from traditional file systems.

Answers

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.

Recursion is a natural use for a _____ (stack or queue)

Answers

Answer:

Stack

Explanation:

Any function that call itself can be regarded as recursive function, it should be noted that Recursion is a natural use for a stack, especially in the area of book keeping.

Recursion is very important because some of problems are usually recursive in nature such as Graph and others, and when dealing with recursion , only base and recursive case is needed to be defined.

Some areas where recursion is used are in sorting and searching.

Today technology is based in Science and engineering, earlier it was based on
__________ _____-_____.

Answers

Answer:

Technical know-how

Explanation:

Write a program to compute answers to some basic geometry formulas. The program prompts the user to input a length (in centimeters) specified as a floating point value. The program then echoes the input and computes areas of squares and circles and the volume of a cube. For the squares, you will assume that the input length value is the length of a side. For the circles, this same value becomes the diameter. Use the meter value input to calculate the results in square (or cubic) meters and then print the answers in square (or cubic) meters.

Answers

Answer:

import math

l = float(input("Enter length in cm: "))

l = l / 100;

print("Entered length is " + str(l) + " meters")

area_square = l * l

print("Area of square is " + str(area_square))

area_circle =  math.pi * l/2 * l/2

print("Area of circle is " + str(area_circle))

volume_cube =  l * l * l

print("Volume of cube is " + str(volume_cube))

Explanation:

*The code is in Python

Ask the user to enter the length in cm

Convert the length to meters and print it

Calculate the area of the square and print it (Since length is equal to a side, the area is length * length)

Calculate the area of the circle and print it (Since length is equal to the diameter, you need to divide it by two to get the radius. The area is pi * length/2 * length/2)

Calculate the volume of the cube and print it (Since length is equal to a side, the volume is length * length * length)

How many pins are in the power supply connector that is typically used on most motherboards today?

Answers

Answer: 4 pins

Explanation:

Answer: 20+4 ATX pins.

Explanation: If you’re talking about supplying power from the PSU to the Motherboard then it would be the 20+4 pin connector. Back on old ATX motherboards it used to be the 20 pin connector.

$8.25/hour; _____$/year, when working 40 hours a week.

Answers

if you work 50 weeks/year and 40 hours/week, you will make 16,500 dollars per year if you make 8.25 per hour

Egyptian hieroglyphs were part of a writing system used by the ancient Egyptians. What type of graphic design elements did they contain?

Answers

Answer:

Logographic, syllabic, and alphabetic elements. I think thts what u were asking for?

Explanation:

_______ tools enable people to connect and exchange ideas.
A) Affective computing.
B) Social media.
C) Debugging
D) Computer forensics.

Answers

Social media is a tool that enables people to connect and exchange ideas. Thus the correct option is B.

What is communication?

Communication is referred to the exchange of information between two individuals in the form of conversation, opinion, suggestion, or advice with the help of medium or direct interaction.

Social media is referred to as a tool of communication that enables people to share their ideas, thoughts, and opinions with a wide network of people and helps them to get information about the events happening in the world.

An internet tool for interaction, information sharing, and social networking is social media. Networking software that connects people around the world is an internet-based technology, strictly understood.

Therefore, option B is appropriate.

Learn more about Communication, here:

https://brainly.com/question/22558440

#SPJ5

Social media is a tool that enables people to connect and exchange ideas. Therefore, the correct answer is option B.

The exchange of information between two people in the form of conversation, opinion, suggestion, or advice with the use of a medium or direct interaction is referred to as communication.

Social media is referred to as a communication tool that enables individuals to communicate their thoughts, ideas, and opinions with a large network of people and assists them in learning about global events.

Social media is an online medium for communication, sharing of knowledge, and social networking. According to the definition of the term, internet-based technology includes networking software that links individuals worldwide.

Therefore, the correct answer is option B.

Learn more about communication here:

brainly.com/question/22558440

#SPJ6

Proper numeric keyboarding technique includes all of these techniques except
O keeping your wrist straight
O resting your fingers gently on the home keys
O looking at the keys
O pressing the keys squarely in the center

Answers

The answer is looking at the keys

Answer: Its the 1st choice, 2nd choice, and the final one is the 4th one. (NOT the third answer choice)

Explanation: (I just took the test)... Hopefully this helps and good luck.

What device to use when downloading a large file?

Answers

Pc is a device to downloading load file

What benefits does the Domain Name System (DNS) provide? Check all that apply.
Network Address Translation (NAT)
Ease of address memorization
Assigning Internet Protocol (IP) addresses
Easy mapping to a new Internet Protocol (IP) address

Answers

Answer:

Option C (Assigning Internet Protocol (IP) addresses) is the correct choice.

Explanation:

DNS is a centralized process for resolving as well as continuing to give IP addresses for something like a specified domain name, a method that allows you to search a site via your web browsers whenever you tab or switch on any web server (Internet Explorer, chrome, respectively.).This helps everyone to still have throughput mostly on the network although one of the databases becomes offline for maintenance.

All other options are not relevant to the situation in question. It is the right answer to all of the above.

Answer:the TCP

Explanation:

paragraph on how atms work

Answers

ATM (Automatic Teller Machine) is a banking terminal that accepts deposits and dispenses cash. ATMs are activated by inserting cash (in cases of ATM Depositing) or debit /credit card that contain the user's account number and PIN on a magnetic stripe (for cash withdrawals)

A general rule for printing is to use _____ fonts for headlines and serif fonts for body text. sans-serif fantasy cursive monospace

Answers

Answer:

sans-serif

Explanation:

Fonts can be defined as a graphical representation of texts which includes a collection of characters such as numbers, letters, symbols etc in various size, color, typeface, design or weight.

A general rule for printing is to use sans-serif fonts for headlines and serif fonts for body text. This ultimately implies that, for any printed work such as novels, books, newspapers etc, it is a general rule for a printer to use sans-serif fonts for headlines and serif fonts for body text in order to enhance readability.

Also, it can be reversed in some instances by using a serif font for headlines and a sans-serif font for the body of a text.

Other Questions
Point V lies between points U and W on line UW. The distance between U and V is 2x-4, and the distance between V and W is 4x+10. If UW = 9x 9, what is UW in units? Formal Religion (going to church) began to take the place of Theater during this time, because it used costumes, props, songs & movement (likedancing.)O TrueO False Clicking and double-clicking are two of the five What is the answer please show work 7x + 4 = 5x + 10 PLS HELP ME ANSWER THIS AS FAST AS POSSIBLE!!!! Graph t> -2 on a number line Rewrite the equation by completing the square.f(x) = x^2 - 2x + 17f(x) = (x + |?|)^2 + |?| PLEASE HELP ASAP THANKS:o)All of the following are reasons people are in favor of homework EXCEPT:Please select the best answer from the choices providedA. B. C. D.? help me plzz i need help woth this plzz help me A tugboat tows a ship at a constant velocity. The tow harness consists of a single tow cable attached to the tugboat at point A that splits at point B and attaches to the ship at points C and D. The two rope segments BC and BD angle away from the center of the ship at angles of = 26.0 and = 21.0 , respectively. The tugboat pulls with a force of 1200 lb . What are the tensions TBC and TBD in the rope segments BC and BD? Please Help! I need the answer. Need your help please. Please help me. Hanson has 38 pieces of candy. He gives away c of the pieces. Write an expression thatshows the number of pieces of candy Hanson has left. Which element has two energy levels magnesium or carbon? Hi I know there are a lot of people that have family or friends with cancer my uncle has cancer and if you are a person that has faith in a god like me please pray for him his name is mark he is dying of it this is his 4th year just please pray. Also if you need prayer put it as an answer. Thank youAudrinasm28he also works for google and knows lots of languages What is the slope the line that passes through the points:(-6, 14), (2, -18)O-4 O144.-4 I need to know how to get the answer with an explanation WHOEVER HELPS ME GETS A BRAINIEST SO PLEASE HELP After 1989, Donna purchased series EE savings bonds for $2,500 at the age of 25. This year she redeemed the bonds for $5,000 and paid qualified higher education expenses for her daughter in the amount of $3,000. How much interest will Donna be required to include in her gross income this year How did the geography of New England affect how people there made living ? What is the value of the expression? 2/3+1/6