id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

james.shockey@austinisd.org > myParseInt
prev  |  next  |  chance

The Java Integer class provides a static method that converts a string to an int. Create a "myParseInt" method to accomplish the same thing.

https://docs.google.com/document/d/13a1XJD1eOfNqFxC8Vg091RM0e26iJI8X6jCkm7V56BM/edit?usp=sharing

public static int parseInt(String s) Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' to indicate a negative value or an ASCII plus sign '+' to indicate a positive value. Parameters: s - a String containing the int representation to be parsed Returns: the integer value represented by the argument in decimal.
int i=Integer.parseInt("200");


myParseInt("125") → 125
myParseInt("-345") → -345
myParseInt("56.7") → 56

...Save, Compile, Run (ctrl-enter)

public int myParseInt(String str) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 399

Copyright Nick Parlante 2017 - privacy