Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Give the output of the following program. Can somebody please tell me how this loop performs and maybe explain why. I got the question wrong
Give the output of the following program. Can somebody please tell me how this loop performs and maybe explain why. I got the question wrong and don't know how.
EMINw"y Program in the box provided public class Main public static void main(String [ args) Fun obj1 new Fun () System.out.println ("Part 1") obj1.tryl) system.out.println ("Part 2") objl.setNumbers (4, 1): objl.tryl ): Fun obj2 new Fun () System.out.println ("Part 3") obj2.try2 (5) ; System.out.println ("Part 4") ; obj2.setNumbers (6, 1); obj2.try2 (13) Fun obj3new Fun (); System.out.println ("Part 5") obj3.setNumbers (2, 5) int answer obj3.mathFun (4); System.out.println (answer) double average; Fun obj4 = new Fun(); int x = 5; methodone (x, obj4); System.out.println ("Part 8" 2 System.out printin ("x - object- obj.getx)) obj4.setNumbers (10, 11) average -findAverage (obj4.getx(),obj4.getY O) System.out.println ("Part 9"); System.out.println ("The average is: " average) public static void methodone (int x, Fun obj) System.out.println ("Part 6") System.out.println("x" x"object xobj.getx()) x 15; obj.setNumbers (17, 20); system.out.println ("part 7"); System . out.println("- " + x + " object x- " + obj.getx()); public static double findAverage (int numl, int num2) double avgi avg (double) (numl+ num2) / 2: return avgi
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started