GBell/LightsOutModel/TextInterface

From ggc

Jump to: navigation, search

01 package GBell.LightsOutModel;
02 
03 import java.util.*;
04 import wiki.Wiki;
05 /**
06  * All about my application here.
07  @author Geremy Bell
08  * originated by Jam Jenkins 
09  */
10 public class TextInterface
11 {
12   public static void main(String[] args)
13   {
14     LightsOutModel model;
15     model=new LightsOutModel();
16     while(model.won()==false)
17     {
18       Wiki.out.println("Board:");
19       Wiki.out.println(model);
20       Wiki.out.println("What row would you like to play (0-4)?");
21       Scanner scanner=new Scanner(Wiki.in);
22       String number=scanner.next();
23       int row=-1;
24       try
25       {
26         row=Integer.parseInt(number);
27       }
28       catch(NumberFormatException nfe)
29       {
30         Wiki.out.println("Not a number: "+number);
31       }
32       Wiki.out.println("What column would you like to play (0-4)?");
33       number=scanner.next();
34       int column=Integer.parseInt(number);
35       if(row>=&& row <=&& column>=&& column<=4)
36       {
37         model.play(row, column);
38       }
39       else
40       {
41         if(row<0)
42         {
43           Wiki.out.println("Row must be 0 to 4 inclusive (not negative).");
44         }
45         if(column<0)
46         {
47           Wiki.out.println("Column must be 0 to 4 inclusive (not negative).");
48         }
49         if(row>4)
50         {
51           Wiki.out.println("Row must be 0 to 4 inclusive (no larger than 4).");
52         }
53         if(column>4)
54         {
55           Wiki.out.println("Column must be 0 to 4 inclusive (no larger than 4).");
56         }
57       }
58     }
59     Wiki.out.println("Congratulations, you won!");
60   }
61 }

Compiler Errors:
----------
1. ERROR in GBell/LightsOutModel/LightsOutModel.java (at line 30)
	cells[row][col]=!cells[r][c];
	                       ^
r cannot be resolved
----------
2. ERROR in GBell/LightsOutModel/LightsOutModel.java (at line 30)
	cells[row][col]=!cells[r][c];
	                          ^
c cannot be resolved
----------
10 problems (10 errors)

Download/View GBell/LightsOutModel/TextInterface.java




Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter