java - Error: Cannot Find Symbol / No Spelling Mistakes? -


basically, want create program find slope of 2 coordinates. i've done this, want program ask if wants re-start-- in, find different slope, without user having exit , re-open program. code, minus unnecessary bits:

import java.io.console;  public class slopefinder{     public static void main(string[] args) {     console console = system.console();     do{     /* code find slope here. asks x1, y1, x2 , y2 values using readline method on console , parses strings , math, obviously.  prints out slope. */     }     string cont = console.readline(" find slope? y/n  ");     }     while (cont.equalsignorecase("y"));     } } 

the issue i'm having i'm getting error "cannot find symbol" in reference line says

while(cont.equalsignorecase("y")); 

i don't understand i'm doing wrong? spelled correctly..

cont declared inside loop, it's not within scope in loop's condition. should declare before loop.

    string cont = "y";     {         ...         cont = console.readline(" find slope? y/n  ");     } while (cont.equalsignorecase("y")); 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -