Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THe following main method should print on out put thje total and average of all numbers in the int[] numbers array. Please complete the coding

THe following main method should print on out put thje total and average of all numbers in the int[] numbers array. Please complete the coding parts of both the getSum and getavg methods. You must use for or while loop statements for both methods.

image text in transcribed

G File: Practice.java CAUsers) W2103619521 Documents -jGRASP CSD (Java) File Edit View Bi Project Settings Tools Window Help All Fil? | So |? ublic class Practice public static void main (String [] args) C1UsersWV210| ? int [ ] numbers { 10, 40, 15, 20, 25, 30, 35, 5); double sum 0, Average=0; sum-getSum (numbers) Average=getavg (numbers) ; System.out.printin(" The Total"+sum; System .out.printIn(" The Average "+ Average); Practice.java public static int getsum (int Array]) int sum=0; //write code here return (sum) public static double getavg (int Array[]) int sum-0 //write code here return (sum/ Array.length) Practice.java Compile Messages jGRASP Messages Run IOInteractions Stop Clear Browse Find Debug Workbench Line:1 Col:22 Code:0 Top:1

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_2

Step: 3

blur-text-image_3

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

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions