Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help wrinting a java program that will find a class ontwo numbers. Here i

ID: 3617293 • Letter: I

Question

I need help wrinting a java program that will find a class ontwo numbers. Here is a piece of the code my teacher gave me:                            TwoNumbers xy;                            xy = new TwoNumbers (8, 2)                            System.out.println(xy.getLargerNumber ( ) ); I need help wrinting a java program that will find a class ontwo numbers. Here is a piece of the code my teacher gave me:                            TwoNumbers xy;                            xy = new TwoNumbers (8, 2)                            System.out.println(xy.getLargerNumber ( ) );

Explanation / Answer

import java.io.*; public class TwoNumbers{ public int x=0; public int y=0; public TwoNumbers(int x, int y) {    this.x =x;    this.y = y; } public int getLargerNumber() {    if(x >=y)        return x;    else        return y; } public static void main(String [] args) {    TwoNumbers xy;         xy = new TwoNumbers (8,2);         System.out.println(xy.getLargerNumber ( ) );     } }