reset password
Author Message
Anonymous
Posts: 166
Posted 11:24 Feb 02, 2014 |

Is this how we can start E 5.7?

public class Integer;

          public static void main(String[] args);

          int number = 1, 2, 5

          System.out.print("Please print integers in order");

 

 

rabbott
Posts: 1649
Posted 11:43 Feb 02, 2014 |

The class Integer is already defined in Java. It's better to use another name. 

I would suggest something like this.

public class E_5_7 {

public static void main(String[] args) {

// read three integers and call 

boolean ordered = isInOrder(n1, n2, n3);

// Tell the user the answer

}

public static boolean isInOrder(int n1, int n2, int n3) {

// return true or false depending on whether n1, n2, n3 are in order

}

}

You should write a JUnit test for isInOrder.