Java Lab
Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the array's numbers on one line, each number followed by one space. (2 pts)
Ex:
Enter weight 1: 236
Enter weight 2: 89.5
Enter weight 3: 142
Enter weight 4: 166.3
Enter weight 5: 93
You entered: 236.0 89.5 142.0 166.3 93.0
(2) Also output the total weight, by summing the array's elements. (1 pt)
(3) Also output the average of the array's elements. (1 pt)
(4) Also output the max array element. (2 pts)
Ex:
Enter weight 1: 236
Enter weight 2: 89.5
Enter weight 3: 142
Enter weight 4: 166.3
Enter weight 5: 93
You entered: 236.0 89.5 142.0 166.3 93.0
Total weight: 726.8
Average weight: 145.35999999999999
Max weight: 236.07 years ago 7
Answer(1)
Purchase the answer to view it
- JAVALAB.docx
- Program1.java
other Questions(10)
- nurs 6541 week 10 application
- Project on Alcohol - Sociological Imagination
- CIS420 Discussion
- ch-3 - home work - First four questions
- FORmadam-professor
- enseignant fiable
- need original work write a 600 word essay please on this case study
- Pay here! Thanks
- week 5 discussion 1 plagiarism free
- The American Civil War was not fought to end slavery but to preserve the Union.” Do you agree or disagree with this statement and why?