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

import java.util.Random ; public class MathTest { public static int genRandom (

ID: 3535044 • Letter: I

Question

 
   import java.util.Random;       public class MathTest  {       public static int genRandom()             {                         return new Random().nextInt(9-0) + 0;             }             public static void main(String[] a)             {                         while(true)                         {                                     Math m=new Math(genRandom(), genRandom());                                     m.menu();                         }             } }    
clone download copy to clipboard compilation info hide
   Main.java:4: error: class MathTest is public, should be declared in a file named MathTest.java public class MathTest         ^ Main.java:14: error: constructor Math in class Math cannot be applied to given types;                         Math m=new Math(genRandom(), genRandom());                                ^   required: no arguments   found: int,int   reason: actual and formal argument lists differ in length Main.java:15: error: cannot find symbol                         m.menu();                          ^   symbol:   method menu()   location: variable m of type Math 3 errors 
 
   import java.util.Random;       public class MathTest  {       public static int genRandom()             {                         return new Random().nextInt(9-0) + 0;             }             public static void main(String[] a)             {                         while(true)                         {                                     Math m=new Math(genRandom(), genRandom());                                     m.menu();                         }             } }    
clone download copy to clipboard compilation info hide
   Main.java:4: error: class MathTest is public, should be declared in a file named MathTest.java public class MathTest         ^ Main.java:14: error: constructor Math in class Math cannot be applied to given types;                         Math m=new Math(genRandom(), genRandom());                                ^   required: no arguments   found: int,int   reason: actual and formal argument lists differ in length Main.java:15: error: cannot find symbol                         m.menu();                          ^   symbol:   method menu()   location: variable m of type Math 3 errors 
      import java.util.Random;          public class MathTest   {        public static int genRandom()              {                          return new Random().nextInt(9-0) + 0;              }              public static void main(String[] a)              {                          while(true)                          {                                      Math m=new Math(genRandom(), genRandom());                                      m.menu();                          }              }  }      

Explanation / Answer

Please check my comment