Question: String indexOf(int ch) int Returns the index within this string of the first occurrence of the specified character. String indexOf(int ch, int fromIndex) int Returns

String

indexOf(int ch)

int

Returns the index within this string of the first occurrence of the specified character.

String

indexOf(int ch, int fromIndex)

int

Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.

String

indexOf(String str)

int

Returns the index within this string of the first occurrence of the specified substring.

String

indexOf(String str, int fromIndex)

int

Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.

String

lastIndexOf(int ch)

int

Returns the index within this string of the last occurrence of the specified character.

String

lastIndexOf(int ch, int fromIndex)

int

Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.

String

lastIndexOf(String str)

int

Returns the index within this string of the last occurrence of the specified substring.

String

lastIndexOf(String str, int fromIndex)

int

Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the specified index.

String

substring(int beginIndex)

String

Returns a new string that is a substring of this string.

String

substring(int beginIndex, int endIndex)

String

Returns a new string that is a substring of this string.

Double

parseDouble(String s)

double

Returns a new double initialized to the value represented by the specified String.

Create a new NetBeans project called yourname_assignment2

Prompt the user to enter a URL string.

Read the input from the keyboard, and store it in a String variable.

For each of the nine parts of the URL, pull the data element of interest out of the URL.

o Usethemethodsinthetableonthepreviouspagetodothefollowing: Use the punctuation in the URL to locate each data element Store each data element to an appropriately-typed variable

o Includeonlythetextportionsforeachdataelement,donotincludetheURL punctuation.

Exception: for the file path, you should omit the start and end slash / characters, but retain the internal slashes that delineate the parts of the file path.

o HINT: you will need more than one method to pull data elements out of the URL. What information do you need before you can assign the data element to a result variable?

o HINT:therearemanypossiblewaystoencodethislogic.Yourapproachmaynotbethe same as other classmates approaches. As long as your logic meets the requirements in this specification, its a good approach.

o HINT:youmaynotneedallofthemethodslistedinthetable,butallarepotentially useful.

Convert the latitude and longitude values to double-typed variables (using the parseDouble method in the table). To prove that you are working with numbers rather than Strings, add 1 to each value, and store the results to new double variables.

Print out the results, following the examples in the sample output. Be sure to follow these examples closely, including output wording, spacing, and punctuation.

When your code is working, upload your .java file to the Assignment 2 dropbox.

SAMPLE INPUT

The following sample input is provided to give you a few test cases. Please keep in mind that your code will be tested with input beyond these strings.

http://fiu.instructure.com/folder/folder/folder/app?map=25.757195|-80.375829

https://www.example.gov/folder1folder1folder1/application?search=24.664648|-82.885596

ftp://www.maprequest.pictureframe/la/di/dah/mapApp?map=25.656248|-80.766333

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!