How would I write this program?

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

How would I write this program?

Post by answerhappygod »

How would I write this program?
How Would I Write This Program 1
How Would I Write This Program 1 (70.63 KiB) Viewed 47 times
public class TeaTimes { } /** * 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). * * @param tea amount of tea * @param candy amount of candy @return outcome of the party */ // TODO: Write method teaParty here... /** * The chemistry club is having an afternoon tea time with * tea and candy. They wish to do a fun chemistry experiment * with their tea and candy before consuming it. Each time *they run their experiment, the amount of candy increases *by a given percentage. * Given the weight of tea and weight of candy they started * with, return the number of times they need to run the * experiment for the weight of candy to exceed the weight * of tea. Return -1 if the experiment will never increase * the candy. * * @param tea starting weight of tea @param candy starting weight of candy * @param percent percentage of candy growth each experiment run @return number of times experiment runs to have more candy than tea */ // TODO: Write method teaTimes here...
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply