(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
Programming in C
Starting out with Visual C# (4th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
C++ How to Program (10th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with Programming Logic and Design (4th Edition)
- The Lo Shu Magic Square is a grid with 3 rows and 3 columns shown below. The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 – 9 exactly The sum of each row, each column and each diagonal all add up to the same number. This is shown below: Write a program that simulates a magic square using 3 one dimensional parallel arrays of integer type. Do not use two-dimensional array. Each one the arrays corresponds to a row of the magic square. The program asks the user to enter the values of the magic square row by row and informs the user if the grid is a magic square or not. Project Specifications Input for this project: Values of the grid (row by row) Output for this project: Whether or not the grid is magic square Processing Requirements Use the following template to start your project: #include<iostream> using namespace std; // Global constants const int ROWS = 3; // The number of rows in the array const int COLS = 3; // The number of columns…arrow_forwardEX15: write a program that return (1) when input number odd return (2) when input number is even 5/7 EX16: write a program that separate the content of a input array (a) into two arrays; (x) : contain the 6/7 numbers with odd index and other array (y) contain numbers with even index . EX17:let you have array A[20], write a program that read the array and swap the content of odd index with 7/7 the content of even index .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_forward
- Debugging 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_forward1.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_forwardJava Programming [ Using Array] - 1arrow_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
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT