Question
Help with strings and class string #typ value; #det value; #loc value; #lat value; #lng value; 1) Make a scanner class to input a message
Help with strings and class string
#typ value; #det value; #loc value; #lat value; #lng value;
1) Make a scanner class to input a message and store into a String variable (message)
2) Parse the message into 5 different types of info specifyed by #(type, location, detail, latitude, and longitude and store these values into their own variables
3) Divide message into the seperate substrings and store in 2 variables(first & last) that hold where the substring first starts and finishes (last)
4) Then when the numbers are assigned to the first and last, discard the # tag(ie. #typ or #loc) and extract where the value starts and finishes
5) Then take the substring at those staring and ending positions to assign it to the variables mentioned in (2)
6) Then trim leading and trailing whitespaces from the strings
7) Then we repeat the steps for each substring
8) Then change the type value into upper case and make the "," in detail and location into "-"
Then print statements showing each variable with the information
Type: VALUE
Detail: value
Location: value
Latitude: value
Longitude: value
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started