Jump to content

  • Log In with Google      Sign In   
  • Create Account

DummyID

Member Since 26 Mar 2013
Offline Last Active Jun 13 2013 05:42 AM

Posts I've Made

In Topic: Game Not Working

19 April 2013 - 02:06 AM

Some1 plz help with this stupid error!!

Don't you think it's a bit stupid that you ask people to sink quite a bit of time into your problem and you don't even have the time or interest to type "someone" and "please"?

>I am using Eclipse... Is it because of Eclipse??

No.

You told Eclipse to launch the application despite the fact that your program is not a valid, compilable Java program. Fix whatever error is around line 65 in DotComBust.java.

 

Well...First of all...I am not a JAVA professional...am still a learner!!

 

Now would you please look into it!!

 

if(you.are.happy){

System.out.println("Please look into it!!");

}else{

System.out.println("Knowledge is Peace!!");

}


In Topic: Game Not Working

19 April 2013 - 01:32 AM


public class DotComBust {
private GameHelper helper = new GameHelper();
private ArrayList<DotCom> dotComsList = new ArrayList<DotCom>();
private int numOfGuesses = 0;
 
private void setUpGame() {
DotCom one = new DotCom();
one.setName("Pets.com");
DotCom two = new DotCom();
two.setName("eToys.com");
DotCom three = new DotCom();
three.setName("Go2.com");
dotComsList.add(one);  
dotComsList.add(two);
dotComsList.add(three);
 
System.out.println("Your goal is to sink three dot coms.");
System.out.println("Pets.com, eToys.com, Go2.com");
System.out.println("Try to sink them all in the fewest number of guesses");
 
for (DotCom dotComToSet : dotComsList) {
ArrayList<String> newLocation = helper.placeDotCom(3);
dotComToSet.setLocationCells(newLocation);
}
}
 
private void startPlaying() {
while(!dotComsList.isEmpty()) {
String userGuess = helper.getUserInput("Enter a guess");
checkUserGuess(userGuess);
}
finishGame();
}
 
 
private void checkUserGuess(String userGuess) {
numOfGuesses++;
String result  = "miss";
for (DotCom dotComToTest:dotComsList) {
result = dotComToTest.checkYourself(userGuess);
if (result.equals("hit")) {
break;
}
if (result.equals("kill")) {
dotComsList.remove(dotComToTest);
break;
}
}
System.out.println(result);
}
 
 
private void finishGame() {
System.out.println("All Dot Coms are dead! Your stock is now worthless.");
if (numOfGuesses <= 18) {
System.out.println("It only took you “ + numOfGuesses + “ guesses.");
System.out.println(" You got out before your options sank.");
} else {
System.out.println("Took you long enough. “+ numOfGuesses + “ guesses.");
System.out.println("Fish are dancing with your options");
}
}
 
public static void main(String[] args) { //Line 65!!
DotComBust game = new DotComBust();
game.setUpGame();
game.startPlaying();
}
}

The error still exists at line 65...I marked the error!!

 

 
Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
 
at DotComBust.main(DotComBust.java:65)
 
Some1 plz help with this stupid error!!
 
I am using Eclipse... Is it because of Eclipse??

In Topic: Game Not Working

17 April 2013 - 05:42 AM

hat chapter of the book is this? If you are just starting out with Java, this program would be an overkill because it involves built-in classes in the language and some he is writing from scratch. I would suggest focusing and writing one class with the main method instead of 4 classes and see what the code is doing line by line.

Well, it;s the full game...and I'm learning from 5 books at the same time so 

having a little hangover!!

 

Plus exams on head!!

 

Will finish it in about a week if I use the forum well!!

 

And I MEAN 1 WEEK TIME CONTINUOUSLY!!

 

not with break!!

 

P.S. chk my page!! 

 

http://fb.com/IntelligenceIsMyCommonSense


In Topic: Game Not Working

17 April 2013 - 05:40 AM

Can you put code tags around your code?
 

// It will be easier to read your code that way.

Will remember that next time!!


PARTNERS