IT145 - 7.5.1 People's Weights.doc - 7.5 People’s Weights 7.5.1 Warm up People’s weights(Java import java.util.Scanner public class PeopleWeights

# IT145 - 7.5.1 People's Weights.doc - 7.5 People’s Weights...

• Homework Help
• 1

This preview shows page 1 out of 1 page.

7.5 People’s Weights 7.5.1 Warm up: People’s weights (Java) import java.util.Scanner; public class PeopleWeights { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); double[] userWeights = new double[5]; double sumWeight = 0.0; double avgWeight = 0.0; double maxWeight = 0.0; int i = 0; for (i=0; i<5; i++){ System.out.println("Enter weight " + (i +1) + ": "); userWeights[i] = scnr.nextDouble(); } System.out.println(""); System.out.println("You entered: " +userWeights[0]+" "+userWeights[1]+" "+userWeights[2]+"

Unformatted text preview: &quot;+userWeights[3]+&quot; &quot;+userWeights[4]+&quot; &quot;); for(i=0; i&lt;5; i++){ sumWeight = sumWeight + userWeights[i]; if(userWeights[i] &gt; maxWeight) { maxWeight = userWeights[i]; } } avgWeight = sumWeight/5; System.out.println(&quot;Total weight: &quot; + sumWeight); System.out.println(&quot;Average weight: &quot; + avgWeight); System.out.println( &quot;Max weight: &quot; + maxWeight); return; } }...
View Full Document

• Summer '14

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern