Question: 8 . Refer to the below example of Inner Class, create, compile and run a Java program that calculates the average, minimum and maximum age
Refer to the below example of Inner Class, create, compile and run a Java program that calculates the average, minimum and maximum age of your friends and family members.
Take screen capture of the program output and code. The program should include nested classinner class, appropriate variables, types and methods. Use an inner class.
class Outer
int nums;
Outerint n
nums n;
void analyze
Inner inOb new Inner;
System.out.printlnMinimum: inOb.min;
System.out.printlnMaximum: inOb.max;
System.out.printlnAverage: inOb.avg;
This is an inner class.
class Inner
int min
int m nums;
forint i ; i nums.length; i
ifnumsi m m numsi;
return m;
int max
int m nums;
forint i ; i nums.length; i
ifnumsi m m numsi;
return m;
int avg
int a ;
forint i ; i nums.length; i
ifnumsi m m numsi;
return a nums.length;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
