Question: Based on the url provided from the user in the existing code, your task is the following: 1 . Create a new Url object named

Based on the url provided from the user in the existing code, your task is the following: 1. Create a new Url object named urlObject (using the Url class mentioned above).2. Set urlObjects completeUrl attribute the the local String variable url provided by the user. 3. Set urlObjects domain, isNonProfit, and isSecure attributes to the correct values. This step will require decision-making and breaking apart the url String. Hints are provided below: a. To populate the domain youll need to extract it from the url String i. Think of what methods you can use in the String class to do this and if there are any special characters in the url syntax that tell us, as humans, where the domain is located. 1. Hint: indexOf(char), lastIndexOf(char), substring(int,int), and substring(int) are all helpful String class methods! Look these up in zyBooks / the Java API to understand how to use them! b. To populate the isNonProfit and isSecure attributes youll also need to use extract information from the url String and use decision (branching) statements to set the values to true or false based on the url syntax. 4. Call the printUrlInfo method with the urlObject to print the url data to the console.

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 Programming Questions!