Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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) 6Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started