(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. Processing Requirements - c++ 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 in the array const int MIN = 1; // The value of the smallest number const int MAX = 9; // The value of the largest number //…arrow_forward8. A magic square is an n by n square in which each element is an integer between 1 and n*n and all column sums, row sums and diagonal sums are equal. For example, the following is a 3 by 3 magic square in which each row, each column, and each diagonal adds up to 15. 4 3 8 9 1 7 6. Write a program that accepts a two-dimensional array size 10 by 10. The program should check and output whether it is a magic square or not. What is the output of the following code?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_forward
- Q2: 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_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_forward
- Problem 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_forwardJava Programming [ Using Array] - 1arrow_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
- /arrow_forwardProgram thisarrow_forwardIndicate 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_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT