Write a recursive, int-valued method, len, that accepts a string and returns the number of characters in the string.
The length of a string is:
0 if the string is the empty string ("").
1 more than the length of the rest of the string beyond the first character.

Answers

Answer 1

Answer:

See Explanation Below

Explanation:

We name our recursive function to be "len" without the quotes

Also, the string whose length is to be calculated is named as StringCalc

Please note that only the function is written; the main method is omitted and it's written in Java Programming Language

The recursive function is as follows:

public int len(String StringCalc){

// Check if StringCalc is an empty string

if (StringCalc.isEmpty())

{

return 0;

}

// If otherwise; i.e. if StringCalc is not empty

else{

// Calculate length of string

int lengths = StringCalc.length();

// Return the length of string from the second character till the last

return (1 + len(StringCalc.substring(1, lengths)));

}

}

// End

The first line of the code declares the recursive function

public int len(String StringCalc)

The next line checks if the input string is empty

if (StringCalc.isEmpty())

This can also be written as

if(StringCalc == "")

If the above is true, the recursive returns the value of 0

Else; (i.e. if it's not an empty string), it does the following

It calculates the length of the string as follows

int lengths = StringCalc.length();

The length of the string is saved in variable "lengths"

Then the length of the string starting from the second character is calculated; since the index string is taken as 0, the recursive consider character at index 1 till the last index.


Related Questions

Elsa has collated information for a meeting using Excel. Due to certain developments, some of the data in her worksheet is now redundant. She deletes three rows from her worksheet to reflect the developments. Which of the following will happen to the rest of the rows in the worksheet when Elsa deletes three rows?

A. ​There will be an empty space where the deleted rows were.B. ​The data from the rows will be shifted to rows at the bottom of the worksheet.C. ​The data from the rows will be shifted to the rows at the beginning of the worksheet.D. ​The remaining rows will shift up to take the place of the rows that were deleted.

Answers

Answer: Option(d) is the correct option

Explanation:

Excel sheets are the spreadsheets which consists of rows and columns for arrangement and display of values.It is used for mathematical function and computation .

According to the question, as Elsa is performing deletion of three rows is done for development, other rows will tend to shift upwards and settle in the deleted row spaces accordingly as per arrangement.

Other options are incorrect because deleted rows will not be indicated through empty spaces,row data won't shift to bottom of sheet and neither shift of data will take place at the starting of sheet.Thus the correct option is option(d).

An administrator is writing into a database and received an error detailed in the exhibit. What two steps need to be taken to resolve this error? (Choose two.) The Prompt command should accept input in Name variable and not Age variable The Insert Statement should not have '$Name$' variable in single quotes. The entire code should be between Prompt Message and Execute SQL statement. Move the Execute SQL statement to be between Connect and Disconnect. Move the Prompt Message to be before the Disconnect statements.

Answers

An administrator is writing into a database and received an error detailed in the exhibit. The two steps to be taken to resolve this are :

Move the Execute SQL statement to be between Connect and Disconnect. Move the Prompt Message to be before the Disconnect statements.

Explanation:

Dynamic SQL refers to SQL statements that are generated at run-time. To disconnect from a database, in the Database Navigator or Projects view, click the connection and then click the Disconnect button in the toolbar or click Database -> Disconnect on the main menu You can also right-click the connection and click Disconnect on the context menuThe PROMPT command may be used to display messages to the user, perhaps supplying a short summary of what your script is going to accomplish.The SQL EXECUTE command executes an SQL command and binds the result to 4D objects (arrays, variables or fields). A valid connection must be specified in the current process in order to execute this command. The sqlStatement parameter contains the SQL command to execute.

The data manipulation language (DML) of SQL contains SELECT, INSERT, DELETE, and UPDATE statements, whereas the data definition language (DDL) of SQL contains CREATE, ______________, and DROP statements. (one word, case insensitive, zero point if misspelled)

Answers

Answer:

"Alter" is the correct answer for the above question.

Explanation:

The DML is a type of SQL command which is used to manipulate the data of the table, it can create or delete or update the data. It holds the command delete, insert, update and select which is mentioned on the question.The DDL is a type of SQl command which is used to define the table and database. It collects the list of command of Alter, create and drop, in which the drop and create are listed in the question but the alter is missing. Hence alter is the correct answer.

Your computer seems to be running slow. In particular, you notice that the hard drive activity light stays lit constantly when running multiple applications and switching between open windows, even though you aren't saving large files. What should you do

Answers

1. Use task manager to monitor memory utilization

2. Use resource monitor to monitor memory utilization

Mr. Hill has 27 students in his class and Mr. Chang has 24 students in his class. Both classes will be divided into equal sized teams within their own classes. What is the greatest number of students that can be on team so that all the teams are an equal number?

Answers

25! 27+24=51 if you divide 51 by two, you get 25.5
Because we can’t have a 0.5th of a child, you can round down to the nearest whole number. Leaving you with 25. Hope this helped :)

(modulus division works well for these kinds of questions)

What does the following fragment of code display? What do you think the programmer intended the code to do, and how would you fix it? int product = 1; int max = 20; for (int i = 0; i <= max; i++) product = product * i; System.out.println("The product is " + product);

Answers

Answer:

0

Explanation:

Given the code segment:

       int product = 1;        int max = 20;        for (int i = 0; i <= max; i++)            product = product * i;        System.out.println("The product is " + product);

Since the counter i in the for loop started with 0, and therefore product * i will always be 0 no matter how many rounds of loop to go through.

The code is likely to perform factorial calculation. To do so, we need to change the starting value for the counter i to 1.

       int product = 1;        int max = 20;        for (int i = 1; i <= max; i++)            product = product * i;        System.out.println("The product is " + product);

Implement a class to represent a playing card. Your class should have the following methods: __ init _ (self, rank, suit) rank is an int in the range 1-13 indicating the ranks ace-king' and suit is a single character "d ' " "c' " "h ' " or "s" indicating the suit (diamonds, clubs, hearts, or spades). Create the corresponding card. getRank(self) Returns the rank of the card. get Suit (self) Returns the suit of the card. value(self) Returns the Blackjack value of a card. Ace counts as 1, face cards count as 10. __ str __ (self) Returns a string that names the card. For example, "Ace of Spades". Test your card class with a program that prints out n randomly generated cards and the associated Blackjack value where n is a number supplied by the user.

Answers

Answer:

from random import randrange

class Card():

def __init__(self, rank, suit):

self.rank = rank

self.suit = suit

def getRank(self):

return self.rank

def getSuit(self):

return self.suit

def value(self):

if self.getRank() < 10:

return self.rank

else:

return 10

def __str__(self):

ranks = [None, "Ace", "Two", "Three", "Four", "Five", "Six",

"Seven", "Eight","Nine","Ten","Jack", "Queen", "King"]

rankStr = ranks[self.rank]

if self.suit == 'c':

suitStr = "Clubs"

elif self.suit == 'd':

suitStr = "Diamonds"

elif self.suit == 'h':

suitStr = "Hearts"

else:

suitStr ="Spades"

return "{0} of {1}".format(rankStr, suitStr)

def main():

n = int(input("How many cards would you like to see? "))

for i in range(n):

rank = randrange(1,14)

suit = "dchs"[randrange(4)]

randCard = Card(rank, suit)

print(randCard, "counts as", randCard.value())

if __name__ == '__main__':

main()

Where should i go if i want to begin learning how to code a video game. What are your recommendations to a 16 yr old to learn coding and become more sophisticated with online engineering.

Answers

Answer:

I would suggest Encode: learn to code

hope this helps :)

Explanation:

Hi my name is Maya how are you today I love brainy so much I juts don't want to ighn in so e jnxjkcsvwjnvhJCJSCB HBEFCHB XBS BHBhhxdhcdgxhBjj`JJHvgbnjnj njdcnjnj

Answers

Answer:

Hey

Explanation:

Answer:

ok hi maya

Explanation:

Suppose that the class Test implements the Comparable interface; has an instance method getID that returns an int; has an instance method getName that returns a String; overrides the compareTo method in such a way that it sorts instances of Test into numerical order on the basis of the value returned by the getID method. If an ArrayList containing instances of Test has been sorted using the compareTo method of Test, let's agree to call it "a sorted Test ArrayList". A two-argument method is needed that takes a sorted Test ArrayList a and a target String s and returns an element of a with a getName method that returns s, or a null reference if there is no such element. Which of the following algorithms can be used to encode this method

Answers

Answer:

import java.time.LocalDate;

import java.util.Objects;

class Employee implements Comparable<Employee> {

   private int id;

   private String name;

   private double salary;

   private LocalDate joiningDate;

See attached image for the full code

If I have a list of peoples hair colour and grades, can I check for the correlation with excel? How?

Answers

Answer:

Explanation:

You can check for correlation using

a. the Analysis Toolpak add-in in Excel to quickly generate correlation coefficients between hair colors and grade; using the following steps.

1. On the Data tab, in the Analysis group, click Data Analysis.

Click Data Analysis

2. Select Correlation and click OK.

Select Correlation

3. select the range of cells that occupies the hair color and grade as the Input Range.

Select the Input Range

4. Check Labels in first row.

5. Select cell A8 as the Output Range.

6. Click OK.

Input and Output Options

Result.

Correlation Coefficients

Yes, you can check for the correlation between hair color and grades using Excel.

Encode the hair color into numeric values, input your data into Excel, and use the CORREL function to calculate the correlation coefficient, which indicates the strength and direction of the relationship.

Here's how you can do it:

Prepare Data: Ensure that your data is organized in two columns, one for hair color and another for grades.Encode Hair Color: Since correlation requires numeric data, you need to encode your hair color data into numbers. For example, assign blonde = 1, brown = 2, black = 3, etc.Enter Data in Excel: Enter your encoded hair color data in one column and the grades in the adjacent column.Use the CORREL Function: In an empty cell, use the formula = CORREL(range1, range2), where range1 is the range of cells for hair color, and range2 is the range for grades.Interpret the Result: The result of the CORREL function will give you the correlation coefficient, which shows the strength and direction of the linear relationship between the variables.

For example, if you have 10 data points where hair color is encoded in column A (A1:A10) and grades in column B (B1:B10), you can use the formula = CORREL(A1:A10, B1:B10) to find the correlation coefficient.

There is a significant diversity among humans with regard to physical abilities, backgrounds, cultures and age. However, by simply designing an interface for the average, generic human, people of various types will be able to conform to the design without toil.a) trueb) false

Answers

Answer: b) False

Explanation:

According to the question, as humans are indulged into various characterization on physical appearance, culture, background etc in social life, they also want some diversity in interface design as well.

Users should be provided with innovative designed that is flexible enough for them to control an monitor.Interface should be able to cope with industrial purpose, commercial purpose, home usage etc.Therefore , normal designing of interface for diverse users will not be obeyed without any hard work as it requires analysis and research towards user and their interface requirement.So, the given statement is false .Thus, the correct option is option(b).

An array of integers named parkingTickets has been declared and initialized to the number of parking tickets given out by the city police each day since the beginning of the current year. (Thus, the first element of the array contains the number of tickets given on January 1; the last element contains the number of tickets given today.) A variable named ndays has been declared and initialized to hold the size of the array. (Thus, if today were January 18, ndays would have the value 18; if today were February 3, ndays would have the value 34.) In addition, a variable named mostTickets has been declared, along with a variable k. Without using any additional variables, and without changing the values of ndays or the elements of the parkingTickets array, write some code that results in mostTickets containing the largest value found in parkingTickets.

Answers

An array of integers named parkingTickets has been declared and initialized to the number of parking tickets given out by the city police each day since the beginning of the current year.

Explanation:

A variable named ndays has been declared and initialized to hold the size of the array.The first element of the array contains the number of tickets given on January 1; the last element contains the number of tickets given today.A variable named mostTickets has been declared, along with a variable k.If today were January 18, ndays would have the value 18; if today were February 3, ndays would have the value 34

mostTickets=0;

for (k=0; k< ndays; k++)

{

if (parkingTickets[k]>mostTickets) mostTickets=parkingTickets[k];

}

Final answer:

To find the largest value in the parkingTickets array without using any additional variables or changing the values of ndays or the elements in the array, you can use a for loop to iterate through the elements of the array.

Explanation:

To find the largest value in the parkingTickets array without using any additional variables or changing the values of ndays or the elements in the array, you can use the following code:



for (int i = 1; i < ndays; i++) {
 if (parkingTickets[i] > parkingTickets[i - 1]) {
   mostTickets = parkingTickets[i];
 }
}



This code iterates through the elements of the array and checks if each element is greater than the previous element. If it is, it updates the value of mostTickets to the current element. At the end of the loop, mostTickets will contain the largest value found in parkingTickets.

Learn more about Finding the largest value in an array here:

https://brainly.com/question/33888086

#SPJ3

which of the following situations demonstrates informational technology used as a primary forcus

Answers

Answer:

Designing and implementing an online voting system

Explanation:

Answer:

Designing and implementing an online voting system

Explanation:

What factors represents one of the sources of value derived from network effects?

Answers

Answer:

The answer is "Staying power"

Explanation:

It is energy or dedication to keep working till the end of what you can do. It is doubtful someone who lacks lasting power and persistence could make an excellent investigator.

Systems with a larger number of people imply a greater lasting power To lengthy-term profitability of a service or product.  To consumers with software items, its longevity, or lengthy-term viability of the good or service is particularly important, and other choices were wrong because it can't be determined in the question.  

Given that a function name f receives three parameters a, b, c, of type double, write some code, to be included as part of the function, that determines whether the value of "b squared" – 4ac is negative. If negative, the code prints out the message "no real solutions" and returns from the function.

Answers

Answer:

def calculatereality(a,b,c):

   if (pow(float(b),2) - 4*float(a)*float(c)) >=0:

       print("real solutions")

   else:

       print("no real solutions")

calculatereality(12,234,12) #This is for output check

Explanation:

The function required is written above. It prints imaginary or real values according to the calculations b^2-4*a*c.

The expression “computer fluency” understates the level of computer skills that hiring businesses expect of today’s college graduates.
true or false

Answers

Answer:

True

Explanation:

Fluency means capability so that means computer fluency means computer capabilities

Can anyone help with this graded assignment for computer fundamentals

Answers

Answer:

Try finding the answer on brainless

Explanation:

That’s all I can do sorry




Clarisse is setting the white spaces at the edge of her Word document to be 1 inch. She is setting the _____.









borders











gridlines











columns











margins

Answers

I'd say Margin.

I dunno about you but It's Margin if I am wrong copy your question and paste it into the URL page, and comb thru the links to see if they helped!

Assume there is a variable, nobel_peace_prizes, that is associated with a dictionary that maps years to winners of the Nobel Peace Prize for that year and assume it is up-to-date through the year 2005. Write a statement that adds an entry that maps the key 2006 to "Muhammad Yunus and Grameen Bank".

Answers

Final answer:

To add Muhammad Yunus and Grameen Bank as the 2006 Nobel Peace Prize winners, add the entry 'nobel_peace_prizes[2006] = "Muhammad Yunus and Grameen Bank"' to the dictionary.

Explanation:

To add an entry that maps the key 2006 to "Muhammad Yunus and Grameen Bank" to the nobel_peace_prizes dictionary, you would use the following Python statement:

nobel_peace_prizes[2006] = "Muhammad Yunus and Grameen Bank"

This statement will append a new key-value pair to the dictionary, where the key is 2006 and the value is 'Muhammad Yunus and Grameen Bank'. This assumes that nobel_peace_prizes is a dictionary that is already defined and associated with the Nobel Peace Prize winners up until the year 2005. By executing this statement, the dictionary gets updated with the Nobel Peace Prize winner for the year 2006.


How does the zone theory of optical systems resolve the apparent incompatibility of trichromacy and opponency?


Answers

Final answer:

The zone theory clarifies that trichromatic theory and opponent-process theory represent different stages of visual processing; cones in the retina respond to red, blue, and green according to trichromatic theory, whereas brain cells process colors in opposing pairs per the opponent-process theory.

Explanation:

Understanding Color Vision Through Zone Theory

The zone theory of optical systems explains how trichromatic theory and opponent-process theory are integrated within the human visual system. The trichromatic theory of color vision asserts that there are three types of cones in the retina, each sensitive to red, blue, or green light. This theory explains color perception at the level of the retina. In contrast, the opponent-process theory suggests that colors are perceived in opposing pairs (red-green, yellow-blue, white-black), a mechanism taking place beyond the retina as signals travel towards the brain.

Crucially, these theories are not contradictory; rather, they describe color vision processes at different stages. Initially, the cones in the retina respond to wavelengths associated with red, blue, and green according to the trichromatic theory. Then, as the visual information progresses to the brain, the neuronal response aligns with the opponent-process theory, with certain nerve cells being excited by one color and inhibited by its opposite.

This layered approach to processing visual information provides a comprehensive explanation of our color vision, including the experiences of negative afterimages and the ability to see colors even when certain types of cones are not functioning correctly, as in the case of color blindness.

Can effective distance learning interaction be achieved on a low-bandwidth mobile device? Your answer should be 3 sentences.

Answers

Answer:

No, this is not possible. Due to low bandwidth, neither video nor teleconferencing will be possible. Moreover, large size study materials will take quite a while to be downloaded and uploaded. And hence, it will be very difficult to ensure distance learning online as student-student, and student-teacher as well as teacher-teacher, and management-teacher-student interaction will be very difficult.

Explanation:

Please check the answer section.

Does anyone know the answer for this? I’m extremely confused.

Answers

Answer:

move 3 right   down 1      3 to the left.  down 2    2 to the right    up one.   1 to the left    one up    2 to the right    and 2 down and your at the end without going back       hope this helps

Explanation:

Answer:

See picture. The secret is: the rules do not say anything about going back to the starting room...

when should you use an electronic spreadsheet

Answers

Answer:

An electronic spreadsheet can be used to perform numerical calculations automatically

Explanation:

An electronic spreadsheet can be used to perform numerical calculations automatically. This spreadsheets are set up in the form of a table with rows and columns.

Data is stored in a cell formed as a result of intersection of each row and column.

Their primary purpose is to organize and categorize data into a logical format. This data then can be used to organize and grow the business.

What is displayed on the console when running the following program?

public class Test {
public static void main(String[] args) {
try {
p();
System.out.println("After the method call");
}
catch (NumberFormatException ex) {
System.out.println("NumberFormatException");
}
catch (RuntimeException ex) {
System.out.println("RuntimeException");
}
}

static void p() {
String s = "5.6";
Integer.parseInt(s); // Cause a NumberFormatException

int i = 0;
int y = 2 / i;
System.out.println("Welcome to Java");
}
}

A. The program displays NumberFormatException.
B. The program displays NumberFormatException followed by After the method call.
C. The program displays NumberFormatException followed by RuntimeException.
D. The program has a compile error.
E. The program displays RuntimeException.

Answers

Answer:

The answer is "Option A"

Explanation:

In the given java code, a class "Test" is defined, inside the main method try and catch block is used, inside the try block method "p()" is called, that print a message. in this block two catch block is used, that works on "NumberFormatException" and "RuntimeException".  In the method "p" declaration, a string variable "s" is defined, that holds double value, that is "5.6", and converts its value into the wrong integer, and other wrong option can be described as follows:

In option B, it is wrong, it is not followed by after call method. In option C, It is not followed by runtime exception, that's why it is incorrect. Option D and Option E both were wrong because they can't give run time and compile-time error.  

Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning function defined to take a Fahrenheit temperature as a parameter. This function should calculate the equivalent Celsius temperature and return it. In the main function, your program should:

Answers

1. Create a module named `temps.py` that contains the conversion functions.

2. Develop the main script to interact with the user and call the appropriate functions.

Here's the code for `temps.py`:

def c_to_f(celsius):

   fahrenheit = celsius * 9/5 + 32

   print(f"{celsius:.3f} Celsius is {fahrenheit:.3f} Fahrenheit")

def f_to_c(fahrenheit):

   celsius = (fahrenheit - 32) * 5/9

   return celsius

And here's the main script:

import temps

def main():

   temperature = float(input("Enter a temperature: "))

   scale = input("Was that input Fahrenheit or Celsius c/f? ")

   if scale.lower() == 'c':

       fahrenheit = temps.f_to_c(temperature)

       print(f"{temperature:.3f} Celsius equals {fahrenheit:.3f} Fahrenheit")

   elif scale.lower() == 'f':

       temps.c_to_f(temperature)

   else:

       print("Invalid input. Please enter 'c' for Celsius or 'f' for Fahrenheit.")

if __name__ == "__main__":

   main()

You can save the first part as `temps.py` and the second part as your main script. The main script will prompt the user for input, determine the scale, and call the appropriate function from the `temps` module to convert the temperature.

The probable question may be:

Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom functionc_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning function defined to take a Fahrenheit temperature as a parameter. This function should calculate the equivalent Celsius temperature and return it. In the main function, your program should:

prompt the user to enter a temperature (as a float type).

indicate the temperature scale of the temperature just entered.

call the appropriate function from the temps module.

if the Celsius temperature is being determined, it should be displayed accurate to three decimal places.

EXAMPLE OUTPUT 1

Enter a temperature 32

Was that input Fahrenheit or Celsius c/f? f

32.0 Fahrenheit equals 0.000 Celsius

EXAMPLE OUTPUT 2

Enter a temperature 100

Was that input Fahrenheit or Celsius c/f? c

100.0 Celsius is 212.000 Fahrenheit

A(n) ________ is a group of senior managers from the major business functions that works with the chief information officer (CIO) to set the information systems (IS) priorities and decide among major IS projects and alternatives.
A) steering committee
B) discussion forum
C) IS department
D) directors committee

Answers

Steering Committee.

Next, Isabela wants to modify a chart in her presentation. How can she access the Chart Tools tab?

Click Select in the Editing group.
Select the chart she wants to modify.
Go the Insert tab, and click Chart.
Click once on the outer part of the chart.

Answers

Answer:

Select the chart she wants to modify

Explanation:

Answer:

Select the chart she wants to modify

Explanation:


Su wants to apply the new font to the other slides of the presentation. She knows she can use the Format Painter tool
to do this.
How does she apply the new font using the paintbrush cursor?
Aside from using Format Painter, what other option or comma
complete

Answers

Answer:

1.) click the text in the text box

2.) replace fonts

Explanation:

e2020

Answer:

How does she apply the new font using the paintbrush cursor?

✔ Click the text in the text box.

Aside from using Format Painter, what other option or command can Su use to complete her task?

✔ Replace Fonts

Explanation:

(Points nearest to each other) Listing 8.3 gives a program that finds two * * points in a two-dimensional space nearest to each other. Revise the program so * * that it finds two points in a three-dimensional space nearest to each other. * * Use a two-dimensional array to represent the points. Test the program using * * the following points: * * double[][] points = {{-1, 0, 3}, {-1, -1, -1}, {4, 1, 1}, * * {2, 0.5, 9}, {3.5, 2, -1}, {3, 1.5, 3}, {-1.5, 4, 2}, * * {5.5, 4, -0.5}}; * * The formula for computing the distance between two points (x1, y1, z1) and * * (x2, y2, z2) is √(x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2.

Answers

Points in a two-dimensional space nearest to each other. This program finds two points in a three-dimensional space nearest to each other.

Explanation:

A two-dimensional array is used to represent the points.The following is tested below : Double[][] points = {{-1, 0, 3}, {-1, -1, -1}, {4, 1, 1}, * * {2, 0.5, 9}, {3.5, 2, -1}, {3, 1.5, 3}, {-1.5, 4, 2}, * * {5.5, 4, -0.5}};The formula for computing the distance between two points (x1, y1, z1) and * * (x2, y2, z2) is √(x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2.

public class Exercise_08_07 {

public static void main(String[] args) {

 double[][] points = {{-1, 0, 3}, {-1, -1, -1}, {4, 1, 1},                      

  {2, 0.5, 9}, {3.5, 2, -1}, {3, 1.5, 3}, {-1.5, 4, 2},                          

  {5.5, 4, -0.5}};

 int p1 = 0, p2 = 1, p3 = 3; // Initial two points

 double shortestDistance = distance(points[p1][0], points[p1][1], points[p1][2],

  points[p2][0], points[p2][p1], points[p3][p2]); // Initialize shortest Distance

 for (int i = 0; i < points.length; i++) {

  for (int j = i + 1; j < points.length; j++) {

   double distance = distance(points[i][0], points[i][1], points[i][2],

    points[j][0], points[j][1], points[j][2]); // Find distance

   if (shortestDistance > distance) {

    p1 = i; // Update p1

    p2 = j; // Update p2

    shortestDistance = distance; // Update shortestDistance

   }

  }

 }

 System.out.println("The closest two points are " +

  "(" + points[p1][0] + ", " + points[p1][1] + ") and (" +

   points[p2][0] + ", " + points[p2][1] + ")");

}

public static double distance(

 double x1, double y1, double z1, double x2, double y2, double z2) {

 return Math.sqrt(Math.pow(x2 - x1, 2) +  

  Math.pow(y2 - y1, 2) + Math.pow(y2 - y1, 2));

}

}

Other Questions
What is the definition of "population growth?" Be specific! * What diplomatic enticement did Kennedy offer the soviets to help solve the Cuban missile crisis? Anti-Federalists were afraid that the new government would be similar to a monarchy. Do you think they were right to have this worry? Why or why not? Explain your answer using specific evidence from the reading passage. Which of the following structures has function in both the female reproductive and urinary systems?A)UrethraB)OvaryC)Fallopian tubeD)Kidney The illustration shows the path of a laser leaving a laser pointer. At what point is the laser being absorbed? Mrs. Vamer deposited q dollars in a bank account that has been earning annual interest The total value of theaccount is based on the function f(x) = 1.025%, where x represents the number of years the money has been in the account If no deposits or withdrawals are made after the initial deposit, which equation represents the total value ofthe account 5 years from now? When Samira was an infant, she was usually calm, uninhibited, and sociable and typically showed interest rather than fear when exposed to new people, novel experiences, and unfamiliar objects. In terms of Kagan's classification of temperamental patterns, Samira is likely to be categorized as a(n): A 100.0 mL sample of 0.20 M HF is titrated with 0.10 M KOH. Determine the pH of the solution after the addition of 75.0 mL of KOH. The Ka of HF is 3.5 10-4 If GDP is going down, what part of the business cycle is the economy in? Which is a TRUE statement about price premiums for differentiated products? Consumers are relatively insensitive to premium prices. Consumers are highly sensitive to price premiums. Consumers are ambivalent to price premiums. None of these What enzyme is lacking in the Escherichia coli strain used by Okazaki in the experiments leading to his discovery of the DNA fragments that will form the lagging strand? a) DNA polymerase b) telomerase c) DNA ligase d) pyrophosphatase CHOOSE ALL THAT APPLYWhich of the following is true about the carbon dioxide cycle?Carbon dioxide is a waste produce of respiration The atmosphere stores more carbon dioxide than the oceanCarbon dioxide is added to the atmosphere by burning fossil fuels Plants use oxygen to make food during photosynthesis ANSWER QUICK From a large-scale screen of many plants of Collinsia grandiflora, a plant with three cotyledons was discovered (normally, there are two cotyledons). This plant was crossed with a normal pure-breeding wild-type plant, and 600 seeds from this cross were planted. There were 298 plants with two cotyledons and 302 with three cotyledons. What can be deduced about the inheritance of three cotyledons I need help. Look at pictureChoose 1 answer:A. -4.63 x 10^13B. -28.7C. -1.65D. -0.14 Have three witches each holding a broom and a spoon. Witches say witch plus witch plus witch =45. Three brooms say broom plus broom plus a broom =21 and three spoons say spoon plus spoon plus spoon = 12 then final question is a plain witch plus broom x spoon equal a ? Whats answer? Glaucoma can be detected at a(n)Cavities, plaque, and tartar can be detected at a(n)Plaque is formed fromin the mouth and can cause cavitiesDuring a dental cleaning, a technician will the patient's teeth to clean in between them. Use the graph to determine the correct relationship between the mean and median. A)mean < median B)median < mean C)median = mean D)mean < median < 6 What is the product of 3a + 5 and 2a2 + 4a 2?6a3 + 22a2 + 14a 10 6a3 + 22a2 + 26a 10 18a3 + 10a2 + 14a 10 28a3 + 14a 10 equations F= -kx F= m x a or F= m x g g= -9.8 m/s2 When a 0.50 kg-object is attached to a vertically supported spring, it stretches 0.10 m from the equilibrium position. Find k for the spring.A.49B.-49C..050D.-0.05 Who were persecuted by the numbers laws in Germany