(Points nearest to each other) Listing 8.3 gives a
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
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
Additional Engineering Textbook Solutions
Electric Circuits. (11th Edition)
Management Information Systems: Managing The Digital Firm (16th Edition)
SURVEY OF OPERATING SYSTEMS
Database Concepts (8th Edition)
Starting Out With Visual Basic (8th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
- JAVA PROGRAM: Monkey Business A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 × 5 array, where each row represents a different monkey and each column represents a different day of the week. The program should first have the user input the data for each monkey, or use constant values rather than asking user for input. Then it should create a report that includes the following information: Display 3X5 array first. Average amount of food eaten per day by the whole family of The least amount of food eaten during the week by any one The greatest amount of food eaten during the week by any one Input Validation: Do not accept negative numbers for pounds of food eaten.arrow_forwardQ2: Write a C# program that read an array A(4x4) of float numbers, and do the following: 1- Print the average of prime numbers in the overall array. 2- Print the summation of odd numbers in the even column and even numbers in the odd row. 3- Replace the first row with the last row and print the new array row by row.arrow_forwardDebugging challenge: Consider the code example below. This program is designed to compare the contents of two arrays: if they are equal, the program should display "TRUE," if the arrays are not equal, the program should display "FALSE". However, even when the arrays have the same value, the program always prints "FALSE", regardless of the values in arrays a and b. What is going on here? What about the program causes the comparison to always fail? int a[4] {1, 2, 3, 4}; int b[4] = {1, 2, 3, 4}; if (a == b) { display ("TRUE"); else { display ("FALSE");arrow_forward
- 1.Write the code to take an array (int stuff[100]) and initialize each element of stuff to -1. 2.Write the code to take an array (int stuff[100]) and initialize each element with user input a.Update the program to sum the values in the array. b.Update the program to print all elements of the array in reverse order. c.Update the program to search through the array and find the smallest value in the array. d.Update the program to search through the array for the value 6, and print “found it”, if it exists. #####java only#####arrow_forwardProblem Description - JAVA PROGRAMMING Use a Two-dimensional (3x3) array to solve the following problem: Write an application that inputs nine numbers, each of which is between 1 and 10, inclusive. Display the array after the user inputs each value. Rotate/flip the array by changing places. Make the rows columns and vice versa. You have to move the elements to their new locations. Remember to validate the input and display an error message if the user inputs invalid data. Documentation and the screenshot(s) of the results. Example: 1 2 3 4 5 6 7 8 9 the result will be : 1 4 7 2 5 8 3 6 9arrow_forwardExample: - Write a program that reads from the user an array with one dimension n and sort the numbers inside the array in descending order.arrow_forward
- Indicate true or false for the following statements: Every element in an array has the same type. The array size is fixed after it is declared. The array size declarator must be a constant expression. The array elements are initialized when an array is declared.arrow_forwardc) Answer the following questions: a. Print all elements of the array (MyList) such that each line has only three elements (two elements with its sum). b. Create a java program that enable you to check if an integer number is divisible by 7 and 9, and also if it's divisible by 7 or 2 but not both.arrow_forwardXy---6. code.arrow_forward
- Answer in C++ Programming Language. C++, Array Write a program that will ask the user to enter a set of numbers and outputs all the subsets of that set. The size of the array is 5. Ask the user if he wants to repeat the program by pressing y/Y.arrow_forwardQ2: Write a C# program that generates an array Y(3x3) randomly (between 55, 666) and print: The average of prime number in secondary diagonal. The summation of each row. The number of odd elements of each even column. Note: Don't use classes or functions to solvethe questionarrow_forwardHow do you access elements of an array? Can you copy an array a to b using b = a?arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT