Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Closed Thread
 
Thread Tools Display Modes
Old Sep 30th, 2005, 12:11 PM   #1
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
Help!!

How can i clear the screen after i choose to start a new game?
import cs1.Keyboard;
import java.util.*;

public class HiLo
{
    public static void main (String[] args)
    {
        int play = 1;
        while(play > 0)
        {
        Random generator = new Random();
        int answer = generator.nextInt(100)+1;
        //System.out.println(answer);
        //int play = 1;
        
        System.out.println("The computer is thinking of a number \nbetween 1 and 100. What is it?");
        int escape = 0;
        while(escape < 1)
        {
        int guess = Keyboard.readInt();
        
        if(guess == answer)
        {
            System.out.println("That's it");
            escape = 1;
        }
        else if(guess > answer)
        {
            System.out.println("Too High");
        }
        else if(guess < answer)
        {
            System.out.println("Too Low");
        }
        }
        
        System.out.println("Would you like to play again (y/n)");
        char again = Keyboard.readChar();
        if(again == 'y')
        {
            play = 1;
        }
        else if(again == 'n')
        {
            play--;
        }
    }
       
    }
}
crawforddavid2006 is offline  
Old Sep 30th, 2005, 1:15 PM   #2
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
What Operating System are you running the program on?
If windows then use
Runtime.getRuntime().exec("cls");
But this way, you'll lose portability. You can always print some blank lines
for(i=0 ;i<30;i++)
System.out.println();
OpenLoop is offline  
Old Sep 30th, 2005, 8:52 PM   #3
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
would i put that at the end of the code?
crawforddavid2006 is offline  
Old Sep 30th, 2005, 9:19 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Please choose a germane subject line. Almost everyone wants HELP!!!. There's a nice "How to Post..." thread in the C forum.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline  
Old Sep 30th, 2005, 9:35 PM   #5
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
What is wrong with you people, READ THE FORUM RULES BEFORE POSTING...!
__________________

tempest is offline  
Old Oct 1st, 2005, 5:53 PM   #6
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
Well I am sorry but when I need help for something in school I need to make it noticable.
crawforddavid2006 is offline  
Old Oct 1st, 2005, 8:35 PM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
It's simply polite to check out a forum's standards instead of presuming it's an extension of your school or your mama or whatever.
Quote:
Originally Posted by How to post a question...
Don't use stupid topic names

Post a descriptive topic name! Give a short summary of your problem IN THE SUBJECT. Don't use attention getting subjects. They don't get attention. They repel attention and annoy people.

Here's a great list of topic subjects YOU SHOULD NOT POST:

1) Help me
2) Hello
3) You must know the answer
4) Please help this newbie
5) Something wrong
6) Come on gurus
7) This one for you
8) Just wondering
9) This is too complicated for me
10) Possible?
11) Very urgent
12) I have a question
13) Stupid question
14) Newbie needs help
15) Pulling my hair out
16) This is driving me nuts

Generally ANYTHING similar to those is unacceptable. Just post your problem.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline  
Old Oct 1st, 2005, 8:47 PM   #8
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
Quote:
Originally Posted by crawforddavid2006
Well I am sorry but when I need help for something in school I need to make it noticable.
You're not an acception to most of the other people that come here you arrogant narcassistic asshole... please leave.
__________________

tempest is offline  
Old Oct 1st, 2005, 9:38 PM   #9
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
I realize that i am not an acception. But this is the best place where i know i can get help when i do not understand something. We are not all perfect like you think you are tempest so fuck off.
crawforddavid2006 is offline  
Old Oct 1st, 2005, 10:55 PM   #10
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
Yea, i'm the one that thinks i'm perfect? Have i asked for help on these forums before, of course i have... And did i read the forum rules before posting, hell yes i did...

I'm not an arrogant prick who would whine with a rude topic like "Help!!" if i wanted to know how to get something done in an assignment for school that i couldn't do myself.

Quite simply, the best way to get help from people is to be courteous to them and respect their institutions.
__________________

tempest is offline  
Closed Thread

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:22 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC