Help with my homework thread
Hello all, i have to take java to finish my degree this year and im having a hard time wrapping my head around things, right when i think i got it....i loose it. So if some of you pros:) dont mind helping i'd appreciate the guidance.
Im current starting the use of methods and classes, below is the description of the problem i have to write code for and what i've written so far which doesnt seem to work.
(problem) create an application named Numbers who's main() method hold two integer variables. Assign values to the variables. Pass both variables to mehtods named sum() and difference (); they compute he sum of and difference between the values of two arguments, respectively. Each method should perform the appropriate computation and display the results.
(havent gotten this far yet)
(2nd half of the problem) Add a method named product() to the numbers class. The product() method should compute the multiplication product of two integers, but not display the answer. Instead, it should return the answer to the calling method, which displays the answer.
public class Numbers
public static void main(String args)
int nNum1 = 12;
int nNum2 = 4;
public static void predictSum()
sum = nNum1 + nNum2;
System.out.prinln(" The sum of numbers on and two is" + sum);
public static void predictDiff()
diff = nNum1 - nNum2;
System.out.println(" The difference between the numbers is" + diff);