Martians wants a program to help them analyze the soil on Mars. They want to determine...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Martians wants a program to help them analyze the soil on Mars. They want to determine the best areas to grow crops. Your program will help them by performing soil analysis. The program will accept two Strings of data from the command line, one containing various soil composition elements and another containing measurements of the respective elements within a set of soil samples. Here's a sample of the two Strings: carbon-dioxide,magnesium, sodium, potassium chloride,water 8.3,4.5,6.7,2.3,12.5,4.5<>3.9,1.8,34.7.23.5, 1.2,14.3<>6.7.7.4,1.5,18.4,7.2,23.7<>23.4,5. 6,2.9,18.5,39.5,18.2<>15.4.5.3,27.4,9.8,3.8,27.4 The element names in the first string are separated by commas. The values in the second string are separated into rows, marked by the "<>" character combination, and columns, separated by commas. Each row corresponds to one sample, and the columns correspond to the elements listed in the first string. Your program will be tested with other datasets in addition to this one. MoonSamples.java will contain these methods. void main(String[] args) ⚫ String[] getElements (String inputElementString) double[][] getSamples (String inputSamplesString) ⚫ int[] searchForLife (double [][] samples) •String searchHighestElements (double [1] samples, String[] elements, int sampleNum) ⚫int searchHighest Sample (double [1] samples, String[] elements, String element) main method The main method will do the following: Get the two Strings from the command line. You can assume that the command-line arguments are valid. Pass the first String to getElements() and store the result • Pass the second String to getSamples() and store the result ⚫ Call searchForLife(), passing in the result of getSamples(), and print the result ⚫Call searchHighestElements(), passing in the results of getSamples() and getElements(), and a sample number, then print the result ⚫Call searchHighestSample(), passing in the results of getSamples() and getElements(). and an element name, then print the result This is a sample output from the main method: The samples that contain life are: 45 The highest elements for sample 1 are chloride and carbon-dioxide The sample with the highest value of the element water is 5 The other methods public static String() getElements (String inputElementString) This method takes in a list of elements in the format described above and returns a String array containing the individual element names. There may be any number of elements. public static double () () getSamples (String inputSamplesString) This method takes in a String of sample values in the format described above and returns a two- dimensional double array containing the values. Here is an example of the arrays created by the first two methods, based on the sample data shown above. carbon dioxide magnesium sodium potassium chloride water carbon dioxide magnesium sodium potassium chloride water Sample 1 8.3 4.5 6.7 2.3 12.5 4.5 2 3.9 1.8 34.7 23.5 1.2 14.3 3 6.7 7.4 1.5 18.4 7.2 23.7 4 23.4 5.6 2.9 18.5 39.5 18.2 5 15.4 5.3 27.4 9.8 3.8 27.4 public static int[] searchForLife (double ( ) ( ) samples) This method takes in a 2D double array of sample values. It will search all samples for the ones that could support life. The criterion for supporting life is based on this formula: • (8 carbon dioxide) + (2 magnesium) + sodium + (4· potassium) + chloride (5 · water) The minimum value for life is 300. If this value is attained or surpassed for a sample, then the sample number (1-based) is included in the array that is returned. For example, If the first row of data attains the score of 300 or more, then the number 1 will be inserted into the first position in the int array. Since not all samples may meet the criteria, the array that is returned should be sized so that it contains only the sample numbers that meet the criterion, with no extra data. This method assumes that there are six columns in the array, and that the samples correspond respectively to the six elements listed in the formula. public static String searchHighestElements (double ( ) (] samples, String() elements, int sampleNum) This method will take in a 2D double array of sample values, a String array of element names, and the number (1-based) of a sample to search. It will return a string containing the names of the two elements that are found in the highest amounts for that sample, in the order of highest first, then second highest element, separated by " and ". For example, if the sample number were 2, based on the example data above the result would be "sodium and potassium". public static int searchHighestSample (double () [] samples, String[] elements, String element) This method will take in a 2D double array of sample values, a String array of element names, and the name of an element to search. If the element exists in the elements array, the method will return the sample number that contains the highest amount of that element. If the element is not in the array, the method will return -1. Deliverables Part 1: Before beginning coding this project, write your algorithms for each method separately in pseudocode (Java code will get zero credit), all in a single document. Make sure that your algorithm steps correspond directly to Java statements (same level of complexity). Submit the pseudocode via Canvas as a doc or pdf file. Part 2: Write the Java program and test your code using the provided JUnit tests. Take a screenshot of the IntelliJ window showing your code passing all JUnit tests. Make sure that the screenshot has your header comment block in it to identify the code. After your program is complete and has been thoroughly tested, submit it to Gradescope. You are allowed only four submissions to Gradescope. After that, the Gradescope component of the score will go to zero automatically. Martians wants a program to help them analyze the soil on Mars. They want to determine the best areas to grow crops. Your program will help them by performing soil analysis. The program will accept two Strings of data from the command line, one containing various soil composition elements and another containing measurements of the respective elements within a set of soil samples. Here's a sample of the two Strings: carbon-dioxide,magnesium, sodium, potassium chloride,water 8.3,4.5,6.7,2.3,12.5,4.5<>3.9,1.8,34.7.23.5, 1.2,14.3<>6.7.7.4,1.5,18.4,7.2,23.7<>23.4,5. 6,2.9,18.5,39.5,18.2<>15.4.5.3,27.4,9.8,3.8,27.4 The element names in the first string are separated by commas. The values in the second string are separated into rows, marked by the "<>" character combination, and columns, separated by commas. Each row corresponds to one sample, and the columns correspond to the elements listed in the first string. Your program will be tested with other datasets in addition to this one. MoonSamples.java will contain these methods. void main(String[] args) ⚫ String[] getElements (String inputElementString) double[][] getSamples (String inputSamplesString) ⚫ int[] searchForLife (double [][] samples) •String searchHighestElements (double [1] samples, String[] elements, int sampleNum) ⚫int searchHighest Sample (double [1] samples, String[] elements, String element) main method The main method will do the following: Get the two Strings from the command line. You can assume that the command-line arguments are valid. Pass the first String to getElements() and store the result • Pass the second String to getSamples() and store the result ⚫ Call searchForLife(), passing in the result of getSamples(), and print the result ⚫Call searchHighestElements(), passing in the results of getSamples() and getElements(), and a sample number, then print the result ⚫Call searchHighestSample(), passing in the results of getSamples() and getElements(). and an element name, then print the result This is a sample output from the main method: The samples that contain life are: 45 The highest elements for sample 1 are chloride and carbon-dioxide The sample with the highest value of the element water is 5 The other methods public static String() getElements (String inputElementString) This method takes in a list of elements in the format described above and returns a String array containing the individual element names. There may be any number of elements. public static double () () getSamples (String inputSamplesString) This method takes in a String of sample values in the format described above and returns a two- dimensional double array containing the values. Here is an example of the arrays created by the first two methods, based on the sample data shown above. carbon dioxide magnesium sodium potassium chloride water carbon dioxide magnesium sodium potassium chloride water Sample 1 8.3 4.5 6.7 2.3 12.5 4.5 2 3.9 1.8 34.7 23.5 1.2 14.3 3 6.7 7.4 1.5 18.4 7.2 23.7 4 23.4 5.6 2.9 18.5 39.5 18.2 5 15.4 5.3 27.4 9.8 3.8 27.4 public static int[] searchForLife (double ( ) ( ) samples) This method takes in a 2D double array of sample values. It will search all samples for the ones that could support life. The criterion for supporting life is based on this formula: • (8 carbon dioxide) + (2 magnesium) + sodium + (4· potassium) + chloride (5 · water) The minimum value for life is 300. If this value is attained or surpassed for a sample, then the sample number (1-based) is included in the array that is returned. For example, If the first row of data attains the score of 300 or more, then the number 1 will be inserted into the first position in the int array. Since not all samples may meet the criteria, the array that is returned should be sized so that it contains only the sample numbers that meet the criterion, with no extra data. This method assumes that there are six columns in the array, and that the samples correspond respectively to the six elements listed in the formula. public static String searchHighestElements (double ( ) (] samples, String() elements, int sampleNum) This method will take in a 2D double array of sample values, a String array of element names, and the number (1-based) of a sample to search. It will return a string containing the names of the two elements that are found in the highest amounts for that sample, in the order of highest first, then second highest element, separated by " and ". For example, if the sample number were 2, based on the example data above the result would be "sodium and potassium". public static int searchHighestSample (double () [] samples, String[] elements, String element) This method will take in a 2D double array of sample values, a String array of element names, and the name of an element to search. If the element exists in the elements array, the method will return the sample number that contains the highest amount of that element. If the element is not in the array, the method will return -1. Deliverables Part 1: Before beginning coding this project, write your algorithms for each method separately in pseudocode (Java code will get zero credit), all in a single document. Make sure that your algorithm steps correspond directly to Java statements (same level of complexity). Submit the pseudocode via Canvas as a doc or pdf file. Part 2: Write the Java program and test your code using the provided JUnit tests. Take a screenshot of the IntelliJ window showing your code passing all JUnit tests. Make sure that the screenshot has your header comment block in it to identify the code. After your program is complete and has been thoroughly tested, submit it to Gradescope. You are allowed only four submissions to Gradescope. After that, the Gradescope component of the score will go to zero automatically.
Expert Answer:
Answer rating: 100% (QA)
The question is asking you to write a program in Java to help analyze soil on Mars and determine the best areas to grow crops The program will take in two Strings one containing the various soil compo... View the full answer
Related Book For
Fundamentals of Cost Accounting
ISBN: 978-0077398194
3rd Edition
Authors: William Lanen, Shannon Anderson, Michael Maher
Posted Date:
Students also viewed these programming questions
-
An individual can deduct for tax purposes the interest expense incurred on the mortgage loan attached to his or her personal residence. Is this statement true? Explain.
-
Jim Dandy Auto Sales uses all types of media to advertise its products (television, radio, newspaper, Internet, and so on). At the end of 2016, the company president, Jim McKinnley, decided that all...
-
Determine the convergence or divergence of the series using any appropriate test from this chapter. Identify the test used. n=1 3.5.7 (2n + 1) 18" (2n-1)n!
-
Redesign the VOCs adsorber of Example 9.15 for a breakthrough time of \(4.0 \mathrm{~h}\). The pressure drop through the bed [calculated using the Ergun equation (2-95)] should not exceed \(1.0...
-
It is the end of 2013. The All-Fixed Company began operations in January 2012. The company is so named because it has no variable costs. All its costs are fixed; they do not vary with output. The...
-
Defining the database management system and identifying the differences between a database and a database management system (DBMS) or relational database management system (RDBMS). Please provide the...
-
1. Which aspect of the French revolution most disturbed commentators? 2. How would you align each of these writers on a spectrum running from extreme right to extreme left in politics? 3. How would...
-
What are the products of the following addition reactions? i got this one wrong CH3-CH=CH-CH3 + HCI Draw the molecule(s) on the canvas by choosing buttons from the Tools (for bonds), Atoms, and...
-
Compute the following values. 1. The quotient of 54 divided by 6. 2. The remainder of 54 divided by 6. 3. The quotient of 1235 divided by 12. 4. 144 mod 7 5. 123 div 7 6. 17 mod 3 - 7. 101 mod 13 -
-
Determine the present value of 10-year bonds payable with the face value of $ 90 000 and stated interest rate of 12%, paid semiannually. The market rate of interest is 12% at issuance Requirement...
-
The Casket Division of Saal Corporation had average operating assets of $1,090,000 and net operating income of $275,200 in January. The company uses residual income to evaluate the performance of its...
-
What role does globalization play in transforming patterns of deviance and social control, as transnational flows of capital, information, and people create new opportunities and challenges for...
-
Find the language accepted by the following Turing machine. x x, R 90 BB, L 93 a a, R x x, R a x, R 91 a a, L x x, L bx, L BB, R 92
-
Shaima is an architecture engineer student. She and her group members designed a traditional restaurant building which won the best project in a research council. Her supervisor, Rami registered the...
-
Floyd Distributors, Inc., provides a variety of auto parts to small local garages. Floyd purchases parts from manufacturers according to the EOQ model and then ships the parts from a regional...
-
Rio Coffee Shoppe sells two coffee drinks, a regular coffee and a latte. The two drinks have the following prices and cost characteristics: The monthly fixed costs at Rio are $6,720. Based on...
-
What costs are included in the full cost of a product? Is a products full cost always the appropriate cost for decision makers to use?
-
If one wishes simply to prepare a cost estimate using regression analysis and enters data into a program to compute regression estimates, what problems might be encountered?
-
A strain rosette consisting of three strain gauges was used to measure the strains at a point in a thin plate of dimensions \(100 \times 20 \times 1 \mathrm{~mm}\). The measured strains in the three...
-
A particle of mass \(m\) slides inside a smooth hemispherical bowl of radius \(R\). Beginning with spherical coordinates \(r, \theta\) and \(\varphi\) to describe the dynamics, select generalized...
-
A small block of mass \(m\) and a weight of mass \(M\) are connected by a string of length \(D\). The string has been threaded through a small hole in a tabletop, so the block can slide without...
Study smarter with the SolutionInn App