Question: Create a class named Done and in that class, Write a function named isEven which takes in a single int parameter and returns a boolean.

Create a class named Done and in that class,

Write a function named isEven which takes in a single int parameter and returns a boolean. This function should return true if the given int parameter is an even number and false if the parameter is odd.

Write a function named close10 which takes two int parameters and returns an int. This function should return whichever parameter value is nearest to the value 10. It should return 0 in the event of a tie. Note that Math.abs(n) returns the absolute value of a number.

Write a method called sumTo that takes two int parameters and returns an int. This function should return the sum of all numbers from the smaller parameter to the larger parameter, inclusive. (i.e. given 2 and 4, returns 9. Because 2 + 3 + 4 = 9) (if given 4 and 2, returns 9 as well. Because 2 + 3 + 4 = 9)

Write a method named rollSnakeEyes which takes no parameters and does not return any value. This method should continually roll two dice and only terminate when both dice are equal to 1. You must roll both dice at the same time. For example, if one die is 1 you can not only roll the other die. For example, if one die is 1 you can not only roll the other die. Print the result of each roll to the console. (So if die one was a 4 and die two was a 6, print "4 6" to the console). Use '(int)(Math.random() * 6) + 1' to simulate a dice roll. (That code will always produce an int between 1 and 6)

When you are finished, submit Done.java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!