Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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: 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
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