Question: 5 . 1 6 LAB: Adjust list by normalizing Whan analyzing data sets, such as data for human haights or for human waights, a comman

5.16 LAB: Adjust list by normalizing
Whan analyzing data sets, such as data for human haights or for human waights, a comman stap is to adjust tha data. This acfustmant can
be dona by nomalizing to values between 0 and 1, or throwing awry outars.
For this prograt, adjust the values by dwiding al values by tha largest valua. The input bagins with an intage indicating the number of
flating-point valuas that followc Assume that the list will ahays contain fower than 20 floating-point valuas.
Qutput aach flazting-point valua with two dipits aftar the daciral point, which can be achizvad as fallews:
syatem.out.printz("E.21*, yourValua);
Ex: If tha ingut is:
530.0,50.0,10.0,100.0,65.0
tha autput is:
0.300.300.101.000.65
The 5 indizatas that there are five fleating-point valuas in the list, namaly 30.0,50.0,10.0,100.0, and 65.0.100.0 is the largest value in the
list, so asch value is divided by 100.0.
For coting simpliaity, follow avary output valua by a soace, insluding the last ona.
LabProgram.java
// Find the Largest value
double raxvalue = values[0]:
for (int 1=1; 1( nunvaloes; ++1){
if (values[1], naxvaloe)[
maxvalue = values[1];
}
// Normalize the values by dividing by the Largest value and print then
for (Int i = e; i nurvaleos; +41){
double norralizedvalue = valoes[i]/ maxvalue;
Systen.out.printf(*%.2f ", norralizedvalue);
// Close the scanner
scnr.close():
}
\5)
When done developing you program, press the Submit for grading button below. This wil
submit you proyam for auto-yrading.
Cociratrall af your work What lathlis?
Latest submission -9:23 PM CDT on 09/25/24
Only show failing tests
1:Compare output a
Output is naarly corract, but whitespaca differs. Sas highights below. Souclel ehasetur lugard
Ingut 530.0,30.0,10.0,100.0,65.0
Your output 0.30,0.30,0.101.00,0.63
Expestad output 0.30,0.300.101.000.63 ##
2:Cormare output A
Output is nearly corract, but whitespace differs. Sae highights below. Souelel chasetarlagurd
Ingut 7,3.0,10.0,15.0,20.0,25.0,30.0,35.0
Yaur output 0.140.29,0.430.37,0.71,0.861.00
Expestad output 00.14,0.29,0.43,0.37,0.71,0.86,1.00, #
5 . 1 6 LAB: Adjust list by normalizing Whan

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!