Question: 1 . Create a new Url object named urlObject ( using the Url class mentioned above ) . 2 . Set urlObject s completeUrl attribute
Create a new Url object named urlObject using the Url class mentioned above
Set urlObjects completeUrl attribute the the local String variable url provided by the user.
Set urlObjects domain, isNonProfit, and isSecure attributes to the correct values. This step will require
decisionmaking 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.
Hint: indexOfchar lastIndexOfchar substringintint and substringint 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.
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
