Question: In Java Code writing (4 questions, 10 points each 9) Write a method (including header and body) that returns an integer representing the outcome of
In Java
Code writing (4 questions, 10 points each 9) Write a method (including header and body) that returns an integer representing the outcome of a party encoded as 0-bad, 1-good, or 2-great. The method takes two integers as arguments: the amount of coffee and the amount of cookies. A party is good (1) if both coffee and cookies are at least 5. However, if either the amount of coffee or cookies is at least double the amount of the other one, the party is great (2). In all cases, if either coffee or cookies is less than 5, the party is always bad (0). Test the program by calling the method from the main method. coffeeParty(6, 8) 1 coffeeParty(3, 8)--0 coffeeParty(20, 6)--2 10) Write a method (including header and body) that calculates the factorial of a non-negative integer. Factorial is defined as n! = n * (n-1) * (n-2) * program by calling the method from the main method. * 1. Note that 0! 1 . Test the calcFactorial(4)-+24 caleFactorial(3) 6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
