Skip to main content
Improved readability, removed non-SE compliant fluff.
Source Link
Mast
  • 13.9k
  • 12
  • 57
  • 128

hello I understand that this project has been posted many years ago but I have noticed a mistake: the program works perfectly except when the first number is negative.

For example, with the following input: -8 + 3 the. The program goes intoenters the function (see stacktrace below) and fails to execute the calculation.

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.charAt(String.java:646)
    at Main.extractNumber(Main.java:161)

hello I understand that this project has been posted many years ago but I have noticed a mistake: the program works perfectly except when the first number is negative.

For example: -8 + 3 the program goes into (see stacktrace below) and fails to execute the calculation.

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.charAt(String.java:646)
    at Main.extractNumber(Main.java:161)

I understand that this project has been posted many years ago but I have noticed a mistake: the program works perfectly except when the first number is negative.

For example, with the following input: -8 + 3. The program enters the function (see stacktrace below) and fails to execute the calculation.

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.charAt(String.java:646)
    at Main.extractNumber(Main.java:161)
added 200 characters in body
Source Link
Heslacher
  • 51k
  • 5
  • 83
  • 177

hello I understand that this project has been posted many years ago but I have noticed a mistake: the program works perfectly except when the first number is negative. 

For example: -8 + 3-8 + 3 the program goes into error(see stacktrace below) and fails to execute the calculation.

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.charAt(String.java:646)
    at Main.extractNumber(Main.java:161)

hello I understand that this project has been posted many years ago but I have noticed a mistake: the program works perfectly except when the first number is negative. For example: -8 + 3 the program goes into error and fails to execute the calculation.

hello I understand that this project has been posted many years ago but I have noticed a mistake: the program works perfectly except when the first number is negative. 

For example: -8 + 3 the program goes into (see stacktrace below) and fails to execute the calculation.

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.charAt(String.java:646)
    at Main.extractNumber(Main.java:161)
added 105 characters in body
Source Link

hello I know it'sunderstand that this project has been posted many years since this projectago but I realize that error ifhave noticed a mistake: the program works perfectly except when the first input valuenumber is negative. You accidentally made changesFor example: ??-8 + 3 the program goes into error and fails to execute the calculation.

hello I know it's been many years since this project but I realize that error if the first input value is negative. You accidentally made changes ??

hello I understand that this project has been posted many years ago but I have noticed a mistake: the program works perfectly except when the first number is negative. For example: -8 + 3 the program goes into error and fails to execute the calculation.

Source Link
Loading