Write a JAVA CODE recursive function that when passed a value n displaysn (n-1) (n-2) (n-3) ... 0 ... (n-3) (n-2) (n-1) nfor example, if passed 5 displays 5 4 3 2 1 0 1 2 3 4 5

Answers

Answer 1
Answer:

//Begin class declaration

public class RecursiveFunction {

   

   //Write function

   //It takes in an int value as parameter

   //And returns a string value.

  public static String recursivefn(int n){

       //Check the value of variable n

       //If the value is less than or equal to 0

       //Return the string "0"

       if(n <= 0){

           return "0";

       }

       

       //If n is not less than or equal to zero,

       //return a string that has:

       //1. n,

       //2. followed by a space,

       //3. followed by another call to the function with n - 1

       //4. followed by a space,

       //5. followed by n

       return n + " " + recursivefn(n-1) + " " + n;

   }

   

   //Begin main method

    public static void main(String []args){        

       //Call the recursivefn() on 5

       System.out.println(recursivefn(5));        

    } //End of main method

   

} //End of class declaration

Sample Output:

5 4 3 2 1 0 1 2 3 4 5

Explanation:

The code has been written in Java. It contains comments explaining important parts of the code. Please go through the comments.

A sample output has also been provided.

The program file and a screenshot of the output have also been attached to this response.

Write A JAVA CODE Recursive Function That When Passed A Value N Displaysn (n-1) (n-2) (n-3) ... 0 ...

Related Questions

Which of the following is the process of writing the step-by-step instructions that can be understood by a computer?

Answers

Answer:

The process should be called an algorithm!

You are a network consultant who has been asked to attend an initial meeting with the executive management team of ElectroMyCycle, LLC. ElectroMyCycle manufactures motorcycles. Its new electric motorcycle was just picked up by a large retail chain. ElectroMyCycle is upgrading its manufacturing capacity and hiring new employees. Recently, ElectroMyCycle employees have started saying, "The Internet is slow." They are also experiencing problems sending email, accessing web-based applications, and printing. In the past, when the company was small, it didn’t have these problems. The operations manager outsourced computer services to a local business called Network Rogues, which installed new workstations and servers as needed, provided desktop support, and managed the switches, router, and firewall. ElectroMyCycle is now considering bringing computer services in-house and is wondering how its network should evolve as it increases production of its electric motorcycle. 1. What research will you do before your initial meeting with the executive management team?
1. Find out the industry and status of the industry the client is in.
2. Client’s market share in the industry
3. Financial growth history of the client
4. Client’s suppliers and customers
5. Products and services offered
6. Any recent important news on client’s business strategies or focus
7. What general problems does ElectroMyCycle seem to be experiencing?

Answers

Answer:

ElectroMyCycle, LLC.

The research I will do before my initial meeting with the executive management team will be to find out the following:

4. Client’s suppliers and customers

5. Products and services offered

Explanation:

My research will concentrate on the types of products and services  that ElectroMyCycle is offering its customers and raw materials that it purchases from the suppliers, because the network assets are being installed to enhance business transactions between ElectroMyCycle and its customers and suppliers.  And as the company is expanding with more suppliers and customers, more products and services, the network configuration will be built around these stakeholders.

Jake is preparing his resume. He is applying for the position of iOS application developer at a large software company. He wants to include his expertise in C++ and Java. Which sub-heading should he use? A. User-centric Design Skills B. Cross-Platform Development Skills C. Modern Programming Language Skills D. Agile Development Skills

Answers

Answer:

C. Modern Programming Language Skills

Explanation:

Consider a variation of Sequential Search that scans a list to return the number of occurrences of a given search key in the list. Does its efficiency differ from the efficiency of classic Sequential Search? Explain.

Answers

Answer:

Considering the fact that the sequential search key must go through the entire list, The search is no different from a classic sequential search.

Explanation:

Sequential search is a form of search in computer science that searches for an item by comparing sequentially items in an ordered list. In big O notation, it take the sequential search O(n) time, with n being the number of items in the list.

This is the same as searching for the occurrence of an item multiple times in the list, as it must go through the entire list items.

Computer ForensicsThere are many differences between public-sector and private-sector computer investigations. What do you see are the top three and why?

Answers

Answer:

For a private computer investigation into cyber crime the private sector  should complete all its courses and must be certified by the relevant authorities and must also be an expert in the computer investigations. while

Public computer investigations has more aspects that involves non-certified personnel's

The private-sector computer investigations are used mostly on all the cyber crimes and hacking and loss of business data.while public-sector computer investigations are used on crimes like rapes, accidents and murders crimes

Explanation:

Computer forensics are used to resolve crimes like cyber crime, hacking, malfunctions and data interrupts.

Before a private computer investigations which is into cyber crime investigation can continue, the private sector  should complete all its courses and must be certified by the relevant authorities and must also be an expert in the computer investigations. while

Public computer investigations has more aspects that involves non-certified personnel's and the personnel's are not necessarily supposed to complete the courses

The private-sector computer investigations are used mostly on all the cyber crimes and hacking and loss of business data.while public-sector computer investigations are used on crimes like rapes, accidents and murders crimes

how do media and networks interact

Answers

Answer:

Media are connected to networks that make information easier to access and pass on.

Assign secretID with firstName, a space, and lastName. Ex: If firstName is Barry and lastName is Allen, then output is:

Answers

Answer:

I'll answer this question using Python

firstName = input("First Name: ")

lastName = input("Last Name: ")

secretID = firstName+" "+lastName

print(secretID)

Explanation:

This line prompts user for first name

firstName = input("First Name: ")

This line prompts user for last name

lastName = input("Last Name: ")

This line calculates secretID

secretID = firstName+" "+lastName

This line prints secretID

print(secretID)

Answer:

My name is Barry Allen, and I am the fastest man alive. When I was a child I saw my mother killed by something impossible. My father went to prison for the murder. Then an accident made me the impossible. To the outside world, I’m an ordinary forensic scientist, but secretly, I use my speed to fight crime and find others like me. And one day, I’ll find who killed my mother and get justice for my father. I am the Flash.

Explanation:

My name is Barry Allen, and I am the fastest man alive. When I was a child I saw my mother killed by something impossible. My father went to prison for the murder. Then an accident made me the impossible. To the outside world, I’m an ordinary forensic scientist, but secretly, I use my speed to fight crime and find others like me. And one day, I’ll find who killed my mother and get justice for my father. I am the Flash.

TLO 06 Active Directory Domain and Trusts tool is used to move servers between site in an AD Infrastructure.a. Trueb. False

Answers

Answer:

b. False

Explanation:

Active Directory Domain and Trusts tool is used for the following operations:

1. To increase the domain functional level

2. To increase forest functional level

3. To add UPN suffixes

4. To manage domain trust

5. To manage forest trust.

Hence, the correct answer is: it is FALSE that Active Directory Domain and Trusts tool is used to move servers between site in an AD Infrastructure

Multiple Single SNMP managers are communicating with a single SNMP agent in:_____.

Answers

Answer:

many-to-many

Explanation:

Many-to-Many Communication is a term that describes a form of online or over the internet communication whereby numerous users are sending and receiving information, in such a way that the recipient does not have the idea of who the receiver is, and neither does the receiver know who the sender is, even though the information facets frequently connects through various websites.

Hence, Multiple Single SNMP managers are communicating with a single SNMP agent in "many-to-many communication."

You need to transmit PII via email and you want to maintain its confidentiality. Which of the following choices is the BEST solution?a. Use hashes.b. Encrypt it before sending.c. Protect it with a digital signature.d. Use RAID.

Answers

Answer:

B. Encrypt

Explanation:

The data, in this case PI will be encrypted from end to end. which means that only the person with the encryption keys is able to read what is in the message. Also the encryption will keep data in motion encrypted during transport.

An app developer is shopping for a cloud service that will allow him to build code, store information in a database and serve his application from a single place. What type of cloud service is he looking for?A. laas(Infrastructure as a Service)B. DaaS (Directory as a Service)C. SaaS (Software as a Service)D. PaaS (Platform as a Service)

Answers

Answer:

Explanation:

We build Database Driven Web Applications tailored to your business. Consulting, UX, Dev. Database Web App Support/Maintenance Experts. Trusted for 15 years. Free Consultation.

You work for a company that is losing sales because it takes days to manufacture products. What technology can you suggest the company use to speed production?

Answers

Answer:

i guess artificial intelligence or robots

The technology can you suggest the company use to speed production is Computer-aided manufacturing.

What is Computer-aided manufacturing?

Computer-aided manufacturing (or CAM for short) is the use of numerical control (NC) software applications with the aim of creating detailed instructions (G code) that drive computer numerical control machine tools ( CNC) for fabrication parts. Manufacturers in many different industries rely on CAM capabilities to produce high-quality parts.  

A broader definition of CAM may include the use of computer applications to define a manufacturing plan for tool design, computer aided design (CAD), model preparation, NC programming, inspection programming coordinate measuring machines (CMM), machine tool simulation or post-processing. The plan is then executed in a production environment, such as direct numerical control (DNC), tool management, CNC machining, or CMM execution.

Therefore, The technology can you suggest the company use to speed production is Computer-aided manufacturing.

Learn more about technology on:

https://brainly.com/question/28288301

#SPJ2

How do others see technology?

Answers

It honestly depends. A lot of people could have different technology views. Imagine this: you meet 2 people. One person loves technology and the other person fears it.

Explain a business scenario where management information systems plays a part.

Answers

Answer:

In this article, we'll cover what is happening with MIS in both business and ... is when you're notified or your credit card is frozen, depending on the situation.

Explanation:




analyze the given code

For I = 1 to n

For j = 1 to n

C =[i.j] = 0

For k=1 to n

C[i.j] = c [i.j] + a[i.k] * b[k.j]

End

End

end

Answers

Answer:

Following are the description to the given code:

Explanation:

In the given code, three for loop are used that uses the variable "I, J, and K", which starts from 1 and ends when it equal to the value of the "n".

Inside the "I and J" loop, another variable "C" is defined, which uses "i,j" and assign a value, that is equal to 0. In the "k" loop, it uses the "c[i.j]" to multiply the value of "a[i.k] and b[k.j]".

In other words, we can say, it calculates the multiplication of the matrix and stores its calculated value.

Addition and subtraction are considered to be ____ operations performed by a computer.

Answers

Answer:

Mathematical operations

Create a query that will list all technician names, employee numbers, and year hired in order by year hired (Newest to Oldest).

Answers

Answer:

SELECT TECHNAME, EMPNUM, YEAR FROM EMPLOYEE ORDER BY YEAR DESC

Explanation:

The table definition is not given;

However, I'll make the following assumptions

Table Name:

Employee

Columns:

Technician name will be represented with Techname

Employee number will be represented with Empnum

Year Hired will be represented with Year

Having said that; the sql code is as follows:

SELECT TECHNAME, EMPNUM, YEAR FROM EMPLOYEE ORDER BY YEAR DESC

The newest year hired will be the largest of the years;

Take for instance:

An employee hired in 2020 is new compared to an employee hired in 2019

This implies that the year has to be sorted in descending order to maintain the from newest to oldest.

Testing mode identify internal components of a computer.

Answers

Answer:

CPU

Heatsink

Motherboard

PSU

HDD

RAM

GPU (If CPU does not have integrated graphics)

Chassis Fans

Some of the internal components of a computer are CPU, RAM, ROM, etc.

What are the internal components of a computer?

Internal components of a computer refer to the parts inside the computer case that enable it to function properly.

We have,

Some of the internal components of a computer are:

- CPU (Central Processing Unit): This is the brain of the computer, responsible for executing instructions and processing data.

- Motherboard: The motherboard is the main circuit board of the computer that connects all the components together.

- RAM (Random Access Memory): This is the computer's temporary storage space, where data and programs are loaded for fast access by the CPU.

- Hard Disk Drive (HDD) or Solid State Drive (SSD): These are the main storage devices in the computer, where all the data and programs are permanently stored.

- Power Supply Unit (PSU): This is responsible for providing power to all the components of the computer.

- Graphics Processing Unit (GPU): This is responsible for rendering graphics and images, and is particularly important for gaming and video editing.

- Sound Card: This component handles the computer's audio processing and output.

- Optical Drive: This is used to read and write data from optical discs such as CDs and DVDs.

- Cooling System: This includes fans and heat sinks that help keep the components of the computer cool and prevent overheating.

- Expansion Cards: These are additional components that can be added to the motherboard to add functionality, such as network cards, sound cards, or video capture cards.

Learn more about internal components here:

https://brainly.com/question/17475476

#SPJ5

If you see or hear of information in the media or on the internet that you suspect is classified, what should you do?

Answers

Answer:

Do not comment on the information or discuss with unauthorized recipients.

Explanation:

As a rule, it is pertinent to have the knowledge that when working with information that are sensitive, one has to be very careful to know and understand what information to share , what not to share and who the recipient should be.

Unauthorized disclosure is when classified information are transfered to unauthorized persons or recipients. Classified information are information not meant for public knowledge which if disclosed, could undermine national security. To be a recipient of classified information, there must be an execution of approved non disclosure agreement, certification of favorable eligibility must be obtained and also possession of the need to know for the classified information.

how do u beat sonic unleashed

Answers

Answer: I guess you gotta do the fast, and then you gotta beat the things up when Sonic becomes even more of a furry ¯\_(ツ)_/¯

Explanation:

Watch playthroughs of the game.

Frame from one LAN can be transmitted to another LAN via the device is:_____.
A) Router.
B) Bridge.
C) Repeater.
D) Modem.
E) None of the above."

Answers

Answer:

B) Bridge.

Explanation:

LAN refers to a local area network in which the network of computer are interconnected in less than an area which is limited i.e. school, university, residence, office building, etc

It is used to share a common line of communication within a less geographic area.

In order to transmit one LAN to the another LAN, the device we called as a bridge

Therefore the correct option is B. bridge

Which command displays the contents of the NVRAM?

Answers

Answer:

Explanation:

NVRAM (nonvolatile random-access memory) is a small amount of memory that your Mac uses to store certain settings and access them quickly. And to show the content of the NVRAM

Show startup-config will display NVRAM content

The internal LAN is generally considered a trusted zone.
a. True
b. False

Answers

Answer:

Option A:

True

Explanation:

The internal LAN is generally considered a trusted zone because it is only accessible by a limited number of users each with a specific administrative privilege. Reduces the occurrence of threats to the system as most of the users are profiled, documented, and well known.

It is a lot more difficult to hack into an internal LAN because of its closed nature, with only a limited number of devices connected. Tracing the source of a security breach is also a lot easier compared to a Wide Area Network.

the task is to ask the user for three numbers and find the average which pseudocode gives you the comment outline for task​

Answers

Answer:

#ask the user for three numbers,

#add the numbers,

#divide by 3,

#print the average

Explanation:

In order to get the average you must add all the numbers together then divide by how many numbers there are

Answer gets the brainliest!!! Choose the venues where audiovisual materials can be found today. (Select all that apply.) schools the internet stores businesses doctors’ offices homes

Answers

Answer:

doctors offices

internet stores buisnesses

Explanation:

Audio Visual Materials (AVMs) are those things can be understood by observing visual aspect of anything's. According to The Librarian Glossary (1987) “AVMs as non-book materials like tapes, slides, films which are renewed and recent to rather then read as books.”

Which Compatibility Modes setting is available for Photoshop?

Answers

Answer:

k

Explanation:

Adnan merges the shapes he added to mimic the bridge structure. The modification is shown below. On the left side are a small square above a long rectangle. An arrow points right to where the small square is positioned partly over the top of the rectangle, to look like a bridge pillar. Which tab did Adnan use to merge the shapes? Which Merge Shapes option did Adnan use? Which property of the shapes did Adnan modify?

Answers

Answer:

The insert tab in the menu was used to select the shapes and all the shapes were selected with the shift key plus left-click on the mouse and on the right-click, a menu pops up and the items were grouped.

Explanation:

Microsoft office word is used in creating and editing text documents. It has several functionalities that can be used to convert documents, create tables, draw shapes, format the arrangement of text in the pages, etc.

To use some of the functions like drawing shapes, go to the insert tab and select "add shapes". There, you can find varieties of shapes and formats and it can be grouped or merged by right-clicking on the selected shapes and clicking on the group option.

Answer:

Which tab did Adnan use to merge the shapes? is drawing tools

Which Merge Shapes option did Adnan use? is combine

Which property of the shapes did Adnan modify? is shape outline

Explanation:

i just did the assignment on engenuity2020

write a python function that takes the largest and smallest numbers in a list, and swap them (without using min() or max() )

Answers

Answer:

def SwapMinMax ( myList ):

   myList.sort()

   myList[0], myList[len(myList)-1] = myList[len(myList)-1], myList[0]

   return myList

   

Explanation:

By sorting the list, you ensure the smallest element will be in the initial position in the list and the largest element will be in the final position of the list.

Using the len method on the list, we can get the length of the list, and we need to subtract 1 to get the maximum element index of the list.  Then we simply swap index 0 and the maximum index of the list.

Finally, we return the new sorted list that has swapped the positions of the lowest and highest element values.

Cheers.

What is one advantage of a magnetic hard drive as compared to a solid state drive?
O It won't be harmed if you drop your computer.
O It spins faster.
O It is open source.
O It is less expensive.

Answers

I’m not 100% sure about this but it it’s D or B

Write, compile, and test a program named PersonalInfo that displays a person's name, birthdate, work phone number, and cell phone number.

Answers

Answer:

//import the necessary libraries

using System.IO;

using System;

//Begin class definition

class PersonalInfo

{

   //Begin main method

  static void Main()

   {

       //Declare all needed variables

       string name;

       string birthdate;

       string workphonenumber;

       string cellphonenumber;

       

       //Prompt user to enter name

       Console.WriteLine("Please enter your name");

       //Receive the user name and store in the name variable

       name = Console.ReadLine();

       

       //Prompt the user to enter date of birth

       Console.WriteLine("Please enter your birthday (dd/mm/yyyy)");

       //Receive the user date of birth and store in the right variable

       birthdate = Console.ReadLine();

       

       //Prompt the user to enter work phone number

       Console.WriteLine("Please enter your work phone number");

       //Receive and store the user work phone number

       workphonenumber = Console.ReadLine();

       

       //Prompt the user to enter cell phone number

       Console.WriteLine("Please enter your cell phone number");

       //Receive and store the user cell phone number

       cellphonenumber = Console.ReadLine();

       

       //Now display the result

      Console.WriteLine("========Your Info========");

       Console.WriteLine("Name: {0} ", name);

       Console.WriteLine("Date of birth: {0} ", birthdate);

       Console.WriteLine("Work Phone Number: {0} ", workphonenumber);

       Console.WriteLine("Cell Phone Number: {0} ", cellphonenumber);

   }

}

Sample Output

Please enter your name

>>Omobowale

Please enter your birthday (dd/mm/yyyy)

>>19/05/1990

Please enter your work phone number

>>08022222222

Please enter your cell phone number

>>08033333333

========Your Info========

Name: Omobowale  

Date of birth: 19/05/1990

Work Phone Number: 08022222222

Cell Phone Number: 08033333333

Explanation:

The code above has been written in C#. It contains comments explaining each line of the code. Kindly go through the comments. A sample output has also been provided.

Should you need the program file, please find it attached to this response.

Other Questions
Frank needs 3.6 meters of ribbon to wrap gifts for friends this year. If each spool contains 90 cm of ribbon,how many spools will Frank need to purchase? Whats 2.3 miles into kilometers Dao receives an employee discount on the purchase of a new automobile. The automobile that he is interested in has a sticker price of $18,560. If his discount is 18 percent, what is the price that Dao will pay?$3,340.80$3,712.00$12,992.00$15,219.20 Following ethical standards that have been outlined by the company you work for are___standards(apex)A.professionalB.personalC.industryD.organizational (GIVING BRISTLIEST) What is 50x+100x-50y? historians label an event as a turning point when it 3x+>4x- select from the drop down menus to correctly justify each step. Point T is on line segment \overline{SU} SU . Given TU=4x+1,TU=4x+1, SU=8,SU=8, and ST=3x,ST=3x, determine the numerical length of \overline{TU}. TU . 1) "A Quilt of a Country" is an argumentative essay. In lines 1-13 the author defines ordelineates at least two ideas for her argument. Identify these two ideas and includequoted evidence to support your answer.2) In lines 14-19, the author makes a counterargument. In your own words, what doesshe mean by "amid all these failures is something spectacularly successful"? Bespecific about her reference to the United States.3) In line 22, the author states that this nation is founded on a conundrum..."Whatdoes she mean? What is so puzzling about our country?4) In the last paragraph on page four (line 40), the author refers to our country as a"splintered whole" in a rhetorical question. How does she feel that the United States isdivided? Provide an example from this paragraph. A ramp is 35 ft long rises to a platform. The bottom is 15 ft from the foot of the ramp. Find x, the angle of elevation of the ramp. Round your answer to the nearest tenth of a degree. A sporting goods sold 2.5 times as many football as basketball last year drag footballs to represent the number of football sold for every 2 basketball sold. If the price of lemons increases, what happens to the supply for lemonade as a result? Pirates Incorporated had the following balances at the beginning of September.Trial Balance September 1 Accounts Debits Credits Cash $ 6,500 Accounts Receivable 2,500 Supplies 7,600 Land 11,200 Accounts Payable $ 7,500 Notes Payable 3,000 Common Stock 9,000 Retained Earnings 8,300 Totals $ 27,800 $ 27,800 The following transactions occur in September. September 1 Provide services to customers for cash, $4,700. September 2 Purchase land with a long-term note for $6,400 from Crimson Company. September 4 Receive an invoice for $500 from the local newspaper for an advertisement that appeared on September 2. September 8 Provide services to customers on account for $6,000. September 10 Purchase supplies on account for $1,100. September 13 Pay $4,000 to Crimson Company for a long-term note. September 18 Receive $5,000 from customers on account. September 20 Pay $900 for September's rent. September 30 Pay September's utility bill of $2,000. September 30 Pay employees $4,000 for salaries for the month of September. September 30 Pay a cash dividend of $1,100 to shareholders.Required: 1. Record each transaction. 2. Post each transaction to the appropriate T-accounts. 3. Calculate the balance of each account at September 30. (Hint: Be sure to include the balance at the beginning of September in each T-account.) 4. Prepare a trial balance as of September 30. What is the name of the piece above?a. Landscape with Socrates on a Hillb. Landscape of RuinC. Landscape with Saint John on Patmosd. Saint Peter on the Isle of Patmos What is the average of 27 degrees celsius, 12 degrees celsius, 31 degrees celcius, 19 degrees celsius, 23 degrees celsius, 11 degrees celsius, and 17 degrees Celsius How much ice at a temperature of -22.3 C must be dropped into the water so that the final temperature of the system will be 30.0 C ?How much ice at a temperature of -22.3 C must be dropped into the water so that the final temperature of the system will be 30.0 C ? A homeowner compared his electric bill from the last four months. In January, his bill was up $30; in February it was up another $6; in March, his bill was down $25; and in April, it was down $16. Which month showed the greatest change in his bill? a. January b. February c. March d. April what is the answer?? Why is wants classified into primary and secondary wants? two young finches stole birdseed.how many adjectives are in the sentence?