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
-
Rosewood Hotel and Resorts discussion: The case deals with the decision of whether the hotel should shift from individual branding to corporate branding. 1) How is Rosewood doing relative to other...
-
Discuss which organizational structure (i.e. functional, product-market divisional, matrix) you would recommend Guelph General Hospital implement, assuming the hospital moves forward with the...
-
Refer to the following matrix below. Two non-collusive aircraft manufacturers, Boeing and Airbus, are playing a game where they have to choose whether to cut or raise prices for the aircraft they...
-
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.
-
At a point due north of the transmitter, how should a second electric dipole antenna be oriented to serve as a receiver? An electric dipole antenna used to transmit radio waves is oriented vertically.
-
1. a spec sheet stating what is required and what to do to accomplish this file import math def number_1(): pyramid_tons = 5900000 years_finished = 20 days_finished = years_finished * 365 t
-
Microsoft considers six principles important to the ethical development and deployment of AI: faimess, reliability and safety, privacy and security, inclusiveness, transparency, and accountability....
-
At December 31, 2008, Belmont Company had a net deferred tax liability of $375,000. An explanation of the items that compose this balance is as follows. In analyzing the temporary differences, you...
-
Yellow Corporation has the following preliminary trial balance, before recording the tax provision. 2019 2020 Cash $ 170,300 $ 185,750 Accounts Receivable 153,000 540,000 Allowance for bad debts...
-
The Northern Company (NC), a major public utility, has awarded a $500m contract to Universal Electric (UE) to build and maintain a liquid sodium nuclear plant. Construction of the project will take 4...
-
You are pushing a car along a straight path for a distance of 20 m. The force (F = 500 N) that you are exerting on the bumper is directed 40 with respect to the path. The tires do not slip on the...
-
How to calculate magnetic moment of matrrial and Permanent magnet.
-
Using the Non-flow energy equation (NFEE), explain the application of the first law of thermodynamics to: a) A single process. b) A complete cycle
-
State what energy is amplified by the difference in areas in the bottle jack
-
Describe the important components of strategic control. What is an organizational culture? In what ways does the organizational culture influence the control structures?
-
If you deposit $300 into an account twice a year that pays 2.8% interest compounded semiannually, how much will you have in the account after 8 years? Identify your variables: PMT 300 T= 0.028 n = 2...
-
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 pictorial or graphical representation of the overall flow of work, documents, and operations in an application system is shown in a(n) ( _____________ ). (a) IPO chart (b) forms distribution chart...
-
Which of the following items would be most useful in analyzing the separation of duties and functions in an application system? (a) document flowchart (b) program flowchart (c) HIPO chart (d) source...
-
An important omission from flowcharts and matrix techniques is ( ___________________ ). (a) the ability to represent decisions (b) the ability to include internal control considerations (c) the...
Study smarter with the SolutionInn App