Question: Lic class PLo1IntParser & Write a 'low-level' method to parse an integer. public static int myparseint(String num) The followings are NOT allowed in 'num'? negative

 Lic class PLo1IntParser \& Write a 'low-level' method to parse an

Lic class PLo1IntParser \& Write a 'low-level' method to parse an integer. public static int myparseint(String num) The followings are NOT allowed in 'num'? negative signs, decimal points. leading white spaces. tratiling white spaces The 'num' nust be base 10 (decinat) Returns NOTINT if 'num' is an illegal integer The objective of the problen is to write your OWN low-level routine to parse the integer. Calling built-in methods such as parseint(), valueof(), etc. defeat the purpose of this exercise. You code HusT perforin the actual hard work of parsing the string. say "75234" to integer 75234. Your code use EXACTLY one loop to examine each character of the input string. find the AscII of the char, convert it to an int of the corresponding digit (eg: char 's' becones int 5); and combine the digits to obtain the answer. RESTRICTIONS * use charAt () exactly one for loop, No nested loops in partfcular use num. length() to control index in the for loop, do not use num. length() elsewhere the loop nust start from left to right (fron the first char to the last char) the loop nust be single pass: no re-examine of previous char, no peeking of next char type casting (to obtain the ASCII) no helper nethod no array, 11st, stack, map, or any other data structure the bulk of your code should consists of the following loop for ( 1 nt 1=;1

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!