Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please I need help with this assignment working with strings. 1.new NetBeans project called yourname_assignment2 2. Prompt the user to enter a URL string. 3.

Please I need help with this assignment working with strings.

1.new NetBeans project called yourname_assignment2

2. Prompt the user to enter a URL string.

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

4. For each of the nine parts of the URL, pull the data element of interest out of the URL. o Use the methods in the table on the previous page to do the following: Use the punctuation in the URL to locate each data element Store each data element to an appropriately-typed variable o Include only the text portions for each data element, do not include the URL 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.

HINT: for some of these elements, you will not be able to get to the data with a single method call to one of the methods in the table. Instead, you will need to invoke a combination of these methods to parse the needed information from the input string. If you cannot identify a single method that does what you need, then start considering combinations of methods to reach the desired data. o HINT: there are many possible ways to encode this logic. Your approach may not be the same as other classmates' approaches. As long as your logic meets the requirements in this specification, it's a good approach. o HINT: you may not need all of the methods listed in the table, but all are potentially useful.

5. 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.

6. Print out the results, following the examples in the sample output. Be sure to match your output to the sample, output, output wording, spacing, and punctuation.

Sample output:

Enter the URL:

http: //www.example.gov/folder1folder1folder1folder1application?search=24.664648|-82.885596

Protocol: https

Subdomain: www

Domain: example

Top-level: gov

Folder path: folderfolder1folder1

Web page: application

Resource: search

Latitude: 24.664648

Longtitude: -82.885596

Latitude plus 1: 25.664648

Longtitude plus 1: -81.885596

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

Students also viewed these Programming questions