I need help with this is Java Api practice

2022.01.26 18:13 Sharp_News3249 I need help with this is Java Api practice

I have to do several coding's this is new to me and my teacher did not really help can someone help me.
these are the instructions

  1. Method hypotenuse(double a, double b)Recall from your studies in mathematics that a right triangle has two perpendicular sides connected to a third side, typically referred to as the hypotenuse. The Pythagorean Theorem states that the relationship between the first two sides, a and b, and the hypotenuse, c, is a2 + b2 = c2. This hypotenuse method accepts values for the right sides of a triangle, a and b, as arguments. Square these two values, add them, and then return the square root of the sum using the Math.pow() and Math.sqrt() methods. Do not use multiplication, and do not use the Math.hypot() method.
  2. Methods max(double a, double b) and min(double a, double b) These methods accept two double values and return the largest or smallest of the two. No special Math or String methods are needed.
  3. Methods max(String a, String b) and min(String a, String b) These methods accept two String values and return the lexicographically bigger or smaller of the two. You will need a String method here.
  4. Method isSameText(String a, String b) This method compares strings a and b to see if they contain the same text. A String method may be needed here.
  5. Method getLongestString(String a, String b, String c) This method compares the number of characters in each string rather than their lexicographic qualities. How do you determine how many characters there are in a string? Since there are three strings to compare, this method is slightly more challenging.
  6. Method getShortestString(List list) The list may contain zero or more strings. Your task is to find the string in the list with the fewest characters. If the incoming list is null or contains zero strings, return null from this method. Otherwise, you will need to loop through the list to find the smallest string. This task will require the use of methods from both the List interface and the String class.
  7. Methods getStringBeforeComma(String s) and getStringAfterComma(String s) These methods expect a string that has a comma somewhere inside of it. Your task will be to correctly provide the text leading up to the comma, as well as the text after the comma, but not the comma itself. This will require at least two methods from the String class.

this is the code I need to solve
import java.util.ArrayList;

public class ApiPracticeRunner {
public static void main(String\[\] args) { print("hypotenuse(3, 4)", ApiPractice.hypotenuse(3, 4), 5.0); print("max(-3, 1)", ApiPractice.max(-3, 1), 1); print("max(40, 40)", ApiPractice.max(40, 40), 40); print("max(4, 10)", ApiPractice.max(4, 10), 10); print("min(-3, 1)", ApiPractice.min(-3, 1), -3); print("min(40, 40)", ApiPractice.min(40, 40), 40); print("min(4, 10)", ApiPractice.min(4, 10), 4); print("max(\\"cat\\", \\"dog\\")", ApiPractice.max("cat", "dog"), "dog"); print("max(\\"Cat\\", \\"dog\\")", ApiPractice.max("cat", "Dog"), "cat"); print("min(\\"cat\\", \\"dog\\")", ApiPractice.min("cat", "dog"), "cat"); print("min(\\"Cat\\", \\"dog\\")", ApiPractice.min("cat", "Dog"), "Dog"); String str1 = "cat"; String str2 = new String("cat"); String str3 = "Cat"; print("isSameText(str1, str2)", ApiPractice.isSameText(str1, str2), true); print("isSameText(str1, str3)", ApiPractice.isSameText(str1, str3), false); String a = "abc"; String b = "abcd"; String c = "ab"; String d = "wxyz"; print("getLongestString(a, b, c)", ApiPractice.getLongestString(a, b, c), b); print("getLongestString(a, b, d)", ApiPractice.getLongestString(a, b, d), b); ArrayList stringList = new ArrayList(); stringList.add("abcde"); stringList.add("abc"); stringList.add("xyz"); stringList.add("jklm"); print("getShortestString(stringList)", ApiPractice.getShortestString(stringList), "abc"); ArrayList stringList2 = new ArrayList(); print("getShortestString(\*empty list\*)", ApiPractice.getShortestString(stringList2), null); String commaString = "Once upon a time, there lived a cat."; print("getStringBeforeComma(commaString)", ApiPractice.getStringBeforeComma(commaString), "Once upon a time"); print("getStringAfterComma(commaString)", ApiPractice.getStringAfterComma(commaString), " there lived a cat."); } private static void print(String methodCall, double result, double expected) { System.out.print("Result of " + methodCall + ": \[" + result + "\] "); if (result == expected) System.out.println("Good!"); else System.out.println("Incorrect. Expected \[" + expected + "\]"); } 

private static void print(String methodCall, String result, String expected) { System.out.print("Result of " + methodCall + ": \[" + result + "\] "); if ((result == null && expected == null) || 
result.equals(expected)) System.out.println("Good!");
 else System.out.println("Incorrect. Expected \[" + expected + "\]"); } private static void print(String methodCall, boolean result, boolean expected) { System.out.print("Result of " + methodCall + ": \[" + result + "\] "); if (result == expected) System.out.println("Good!"); else System.out.println("Incorrect. Expected \[" + expected + "\]"); } 

private static void printBlankLine() { System.out.println(); } 
}





and this what I put the codes in

import java.util.List;

public class ApiPractice {
/**
* Finds the hypotenuse of a right triangle given sides a and b.
* u/param a Length of side a.
* u/param b Length of side b.
* u/return Length of hypotenuse.
*/
public static double hypotenuse(double a, double b) {
/* Add code here. Fix placeholder return statement. */
return -1;
}
/**
* Returns the greater of two values. If the values are exactly the same,
* it returns one of them.
* u/param a First value.
* u/param b Second value.
* u/return Largest value.
*/
public static double max(double a, double b) {
/* Add code here. Fix placeholder return statement. */
return -1;
}
/**
* Returns the smaller of two values. If the values are exactly the same,
* it returns one of them.
* u/param a First value.
* u/param b Second value.
* u/return Smallest value.
*/
public static double min(double a, double b) {
/* Add code here. Fix placeholder return statement. */
return -1;
}

/**
* Returns the lexicographically greater of two strings. If the values are
* exactly the same, it returns one of them.
* u/param a First string.
* u/param b Second string.
* u/return Lexicographically greatest string.
*/
public static String max(String a, String b) {
/* Add code here. Fix placeholder return statement. */
return "unknown";
}
/**
* Returns the lexicographically lesser of two strings. If the values are
* exactly the same, it returns one of them.
* u/param a First string.
* u/param b Second string.
* u/return Lexicographically lesser string.
*/
public static String min(String a, String b) {
/* Add code here. Fix placeholder return statement. */
return "unknown";
}
/**
* Compares two strings to see if they contain the same text.
* u/param a First string.
* u/param b Second string.
* u/return true if the strings contain the same text,
* false otherwise.
*/
public static boolean isSameText(String a, String b) {
/* Add code here. Fix placeholder return statement. */
return false;
}
/**
* Returns the longest string (the string with the greatest number of
* characters) out of three strings. If two or more strings have the same
* number of characters, it returns the first one.
* u/param a First string.
* u/param b Second string.
* u/param c Third string.
* u/return String with the fewest characters.
*/
public static String getLongestString(String a, String b, String c) {
if (a.length()>b.length()&& a.length() >c.length())
return a;
if (b.length()>a.length()&& b.length() >c.length())
return b;
if (c.length()>a.length()&& c.length() >b.length())
return c;
if (a.length()==b.length())
return a;
if (a.length()==c.length())
return a;
if (b.length()==c.length())
return b;
return a;
}
/**
* Returns the shortest string (the string with the lowest number of
* characters) from a list of strings. If two or more strings have the
* same number of characters, it returns the first one.
*
* If the incoming list is null or contains zero strings,
* this method returns null.
*
* u/param list List of incoming strings.
* u/return String with the fewest characters.
*/
public static String getShortestString(List list) {
/* Add code here. Fix placeholder return statement. */
return "unknown";
}
/**
* Returns a substring of the incoming string that contains all of the
* characters leading up to, but not including, the comma found
* in the string.
* u/param s A string with a comma somewhere inside of it.
* u/return The substring leading up to the comma.
*/
public static String getStringBeforeComma(String s) {
/* Add code here. Fix placeholder return statement. */
return "unknown";
}
/**
* Returns a substring of the incoming string that contains all of the
* characters after the comma found inside the string.
* u/param s A string with a comma somewhere inside of it.
* u/return The substring after the comma.
*/
public static String getStringAfterComma(String s) {
/* Add code here. Fix placeholder return statement. */
return "unknown";
}
}
submitted by Sharp_News3249 to computerscience [link] [comments]


2022.01.26 18:13 elegantloveglimmer Hair behind ear (langmalan) [Original]

Hair behind ear (langmalan) [Original] submitted by elegantloveglimmer to kawaiidesune [link] [comments]


2022.01.26 18:13 yaboyckay I dont think anything needs to be said...

I dont think anything needs to be said... submitted by yaboyckay to ImageComics [link] [comments]


2022.01.26 18:13 mheadley84 [LF] Oranges

Hello! I’m simply looking for oranges. It’s the last fruit I need. Let me know what I can do to get some oranges!
submitted by mheadley84 to AnimalCrossingTrading [link] [comments]


2022.01.26 18:13 opal_monkey Using a HELOC from house-hack to invest in another property.

My situation: I currently house hack a triplex that I currently owe $450k. The current estimated value is $1,000,000 conservatively (could be more like $1,100,000+ but comps for this property are hard to come by. There are two one-bedrooms upstairs that rent for $1,500 and I occupy the lower levels which is a 3 bed 2 bath that would likely rent for $3,500. My PITI is $2,000 a month and the total rental income is $3,000 a month. I currently have saved up $30,000 earmarked for real estate investing to expand my real estate portfolio and have other monies tied up in the stock market that I would not like to sell unless the market is near all-time highs, so not right now.
My plan: My current thought to expand my portfolio is to get a HELOC for as much as possible and then use that money for either a 20% down-payment on another property or else buy one cash. I would be looking for a property that needs minor cosmetic updates; either a single-family for rental, a single-family with a MIL suite, or else a small multifamily 2-4 unit property. I would then do some strategic cosmetic repairs and refinance to payback HELOC, rinse and repeat over and over. I am hoping others can poke holes in my strategy or else figure out if an alternative would work better. I would be happy to provide more information if needed. I would likely be making my next move in late fall/next winter.
submitted by opal_monkey to realestateinvesting [link] [comments]


2022.01.26 18:13 SnooGoats6509 I got a guitar yesterday and I want to learn how to play it

Is there a app that dosnt cost any money that I can download?
submitted by SnooGoats6509 to guitarlessons [link] [comments]


2022.01.26 18:13 dr0id3r99 Peppa Pig: Story Time Box 42% OFF!! https://amzn.to/3IH9LwI

Peppa Pig: Story Time Box 42% OFF!! https://amzn.to/3IH9LwI submitted by dr0id3r99 to marcazon [link] [comments]


2022.01.26 18:13 ezol_design Custom Homes

What is important in designing custom homes?
submitted by ezol_design to architecture [link] [comments]


2022.01.26 18:13 noobfl ich_iel

ich_iel submitted by noobfl to ich_iel [link] [comments]


2022.01.26 18:13 Yungestflexxer How to overcome a 40% tax someone please order some advice

So the past year I have earnt 48k before tax (20%) and am pretty sure I should be paying 40% by now but I haven’t. Not sure how it all works though, when I submit my return will I just get counter charged for the tax I haven’t paid?
is there anyway I can avoid paying 40% can I lose some of my earnings in an isa or Lisa/pension so I won’t have to get charged the 40% I have always paid my taxes but it is a joke, with inflation and cost of living the government should really raise the tax bracket up but no they try to squeeze the working man for every hard earned penny he makes. Please can I have some advise on how to get around this
submitted by Yungestflexxer to LegalAdviceUK [link] [comments]


2022.01.26 18:13 CommissionerAsshole Jurassic Park callback

Among all the other easter eggs and callbacks, Bryce Dallas Howard, a veteran of the Jurassic Park movies, threw in a raptor callback with the womp rat and Amy Sederis, with thankfully different results.
This comes on the heels of her prior episode with the AT-STyrannosaurus Rex.
I hope we get more of this from her future works! It's the best kind of callback that evokes the original with a wink and a nod without breaking the star wars universe.
submitted by CommissionerAsshole to BookOfBobaFett [link] [comments]


2022.01.26 18:13 what-the-crust several hours after promising myself i would do a simple design…

several hours after promising myself i would do a simple design… submitted by what-the-crust to simplynailogical [link] [comments]


2022.01.26 18:13 Tongpete Hey Madison. What do you pay in Mortgage payment per month? Square Footage? Location?/Down payment? 15/30/45 year loan? Interest Rate? Fixed Rate or Variable? Local or National Financing? Year Bought?Bedrooms/Bathrooms? Garage or off street parking?

Offshoot of the Rent question/thread.
submitted by Tongpete to madisonwi [link] [comments]


2022.01.26 18:13 Status-Preparation-6 Hard to get fills on paper trade, is it better on live?

submitted by Status-Preparation-6 to interactivebrokers [link] [comments]


2022.01.26 18:13 Taurus_taurus Taurus women

What do you think about Taurus(f) and Scorpio (m) ?
submitted by Taurus_taurus to Scorpio [link] [comments]


2022.01.26 18:13 circinus_asmr [M4A] Dominant Delinquent Pins You Against The Lockers [SFW] [Delinquent] [Schoolmates] [Cute] [Strangers to More] [Good Student x Bad Student] [Nerdy Listener]

Summary: After receiving gifts from the juniors on their birthday, the goody two shoes excuses themselves to go to the bathroom in attempts to put away the gifts they received, but along the way, they bump into the delinquent batchmate who they never met before.
The script was written by u/skippyppiks
Listen my fill in Youtube and Soundgasm.
Stay safe and sleep well!
submitted by circinus_asmr to AudioCandy [link] [comments]


2022.01.26 18:13 jackie_skywater I adore her 💕

I adore her 💕 submitted by jackie_skywater to madnesscombat [link] [comments]


2022.01.26 18:13 animagniv17 new PC doesn’t boot to bios, black screen

hi, today i purchased a new pc.
Specs: Asus prime x570-p Ryzen 7 5800x Rtx 3060 eagle Corsair vengeance pro 2x8 DDR4 3200mhz
i booted it for the first time, waited more than 20 minutes and for some reason i had a black screen and the computer doesn’t respond at all.
After 30 minutes of restarting the computer to try to make it boot into bios it somehow booted into bios once and i put the windows installation flash drive into the boot priority, pressed F10 and then it returned to the same black screen from before.
i tried taking the cmos battery out and put it back in, i tried putting the ram sticks into a different slot but nothing helps. what can i do? i can try to update the bios because i dont even have a display
submitted by animagniv17 to ASUS [link] [comments]


2022.01.26 18:13 Max_patronov If you only know how I like to paint mages:) Miniature from First Legion Fantasy series

If you only know how I like to paint mages:) Miniature from First Legion Fantasy series submitted by Max_patronov to minipainting [link] [comments]


2022.01.26 18:13 hullopalooza Take a look around you nothings what it seems.

https://music.youtube.com/watch?v=_GorjQ1K8-U&feature=share
submitted by hullopalooza to Hullopalooza [link] [comments]


2022.01.26 18:13 mossopossum what's the healthiest, small breed of goldfish?

I want to get two (maybe three, but probably just two) goldfish for a 70 gallon tank. I originally wanted fantails, since they looked like they were the least 'pug like' of goldfish. Problem is, I can't seem to find anywhere that sells fantail goldfish, I think because I did a dumb and mistook a tail type for a breed. :/
anyways, I'm wondering what are some small, healthy goldfish breeds that would fit in a 70 gal?
(and when I say 'healthy' I mean having the least problems based on how they were bred. like I know bubble eyes can have issues with their eyes popping, and that long tails make swimming harder, so a breed that could function as a normal fish w/o health problems related to their looks/breed)
TLDR : looking for healthy, small goldfish breeds that would fit 2 in a 70 gal. (like mini comets ig lol)
TIA! :)
submitted by mossopossum to Goldfish [link] [comments]


2022.01.26 18:13 jobsinanywhere U.S. Government Bond Yields Stable Ahead of Fed Announcement

submitted by jobsinanywhere to newslive [link] [comments]


2022.01.26 18:13 Bikram_Saini How do you deal with the reality of this verse?

Al-Kahf 18:6
فَلَعَلَّكَ بَٰخِعٌ نَّفْسَكَ عَلَىٰٓ ءَاثَٰرِهِمْ إِن لَّمْ يُؤْمِنُوا۟ بِهَٰذَا ٱلْحَدِيثِ أَسَفًا
Then perhaps you would kill yourself through grief over them, [O Muhammad], if they do not believe in this message, [and] out of sorrow.
The more and more I think of this verse and its implications, the more I get this awful feeling. All of the people (non-Muslims) around you, the ones you know and the ones you don't, the ones you listen to and the ones who listen to you, people who you consider your friends or people who consider you their friend. To think that in the end they'll all end up in Hell for eternity is something I struggle with a lot. I never actually truly understood what this verse was talking about until recently. How do you guys deal with that?
submitted by Bikram_Saini to islam [link] [comments]


2022.01.26 18:13 SCP_048 Uncharted Behind the Scenes - A Day of Stunts (2022) | Movieclips Trailers

Uncharted Behind the Scenes - A Day of Stunts (2022) | Movieclips Trailers submitted by SCP_048 to NewMovies [link] [comments]


2022.01.26 18:13 NoSleepTill-Brooklyn 23/EST/PC Big variety gamer looking for people that love to chat about anything! - Big emphasis on Pokemon right now

-If you've messaged me before, feel free to say hi again. I'm not the best at keeping up with new friends but once we talk a few times I'll be all over you. Everyone is so quick to unfriend and block nowadays-
Heya everyone! So a little about me, I'm a college dropout who spends all my time currently just playing video games and watching youtube. I'm always looking for more people to meet, chat with, and hopefully become friends!
As for my interests, obviously video games and music which are pretty universal here as well as sports and anime.
As for my favorite games, I used to play a lot of League, WoW, and Overwatch but have fallen out of favor with those. Risk of Rain 2 is always a mainstay, I've been big on Super Auto Pets and Fallout 4 lately but obviously those are single player but sometimes it's just fun to talk about games!
I have a massive library and just like to talk about anything so feel free to hit me up and try to make a new friend! Please be LGBT friendly (emphasis on the T, I don't want to have to deal with being misgendered because of my voice. Thanks!)
YseraTheDreamer7#7777 on discord
submitted by NoSleepTill-Brooklyn to GamerPals [link] [comments]


http://heatprofi.ru