Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

=+country competitive advantages? Why? Support your point of view.

Answered: 1 week ago

Question

=+from: a) a MNEs perspective? and b) the HRM managers perspective?

Answered: 1 week ago