Question: Write a function in Java that implements the following logic: We are having a party with amounts of tea and candy. Return the int outcome

 Write a function in Java that implements the following logic: Weare having a party with amounts of tea and candy. Return the

Write a function in Java that implements the following logic: We are having a party with amounts of tea and candy. Return the int outcome of the party encoded as 0= bad, 1 = good, or 2= great. A party is good (1) if both tea and candy are at least 5. However, if either tea or candy is at least double the amount of the other one, the party is great (2). However, in all cases, if either tea or candy is less than 5 , the party is always bad (0). Your Answer: Feedback Your feedback will appear here when you check your answer. A rational number is a number that can be represented as the ratio of two integers. For example, 2/3 is a rational number, and you can think of 7 as a rational number with an implicit 1 in the denominator. For this question you will be working within the following class: Write an invert ( ) method for this class that swaps the numerator and denominator. However, this method should only perform the swap if the numerator is not initally 0. For example, inverting 7/3 will change the fields to represent 3/7. However inverting 0/9 should do nothing. This method will not need to return anything and does not need any parameters. Hint: in the invert ( ) method, you may need to create another variable inside this method to help you with the swap

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!