Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribedimage text in transcribedimage text in transcribed

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 Ja J Q1 Tester.java J Q2.javax D Q2Tester.java import java.util.Scanner; WNP 3 //Name: 4 //Student number: public class Q2 { void ReadIn(double thresh), //Don't modify any code above this line //Your code goes here to read in test results and decide whether they passed xy Q1.java u Q1 Tester.java JQ2.java DQ2Tester.java X, 2 7/Don't modify this file PREEO00 NOU AWNP a public class Q2Tester { public static void main(String[] args) { Q2 92 = new Q2(); 92. ReadIn(20)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

OUTCOME 2 Identify and explain the privacy rights of employees.

Answered: 1 week ago