Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 2: A task in civil engineering is testing the strength of samples of concrete. The samples are put under increasing pressure until they break.
Question 2: A task in civil engineering is testing the strength of samples of concrete. The samples are put under increasing pressure until they break. Your method needs to read in the breaking pressure of multiple tests from the console until the user enters -1. The test results are floating point numbers. The method needs to compare each test result with a threshold value that is the input argument of the method. If a result is above the threshold, the sample has passed. If it is below the threshold, the sample has failed. Count the number of passes and fails and output the result to the console at the end. Also calculate and output the average breaking pressure for all the passed samples. The output when you run Q2Tester needs to match the below format. Green numbers are user inputs to the console. Don't modify Q2Tester or any of the parts of Q2 that are given (the class and method declarations)! Enter the result of the test: 20.5 Enter the result of the test: 76.3 Enter the result of the test: 10.1 Enter the result of the test: 58.4 Enter the result of the test: -1 Number passed samples: 3 Number failed samples: 1 Average breakpoint of passed samples: 51.73333333333333 2 import Close util.Scanner; 3 4 1/Name: //Student number: 6 public class Q2 { Q void ReadIn(double thresh) 10 //Don't modify any code above this line //Your code goes here to read in test results and decide whether they passed 11 12 13 14 15 16 17 } 18 19 2 //Don't modify this file 4 public class Q2Tester { public static void main(String[] args) { Q2 92 = new Q2(); 92. ReadIn(20); 12 14
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started