Cis 355 ilab 5 of 6
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
450
On Slideshare
450
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. CIS/355 iLab 5 of 6STEP 1: GuessGameWrite a program named GuessGame.java that plays the game “guess the number” as follows:Your program chooses the number to be guessed by selecting an integer at random in the range 1–1000. The program then displays the following in a label.I have a number between 1 and 1000 -- can you guess my number?Please enter your guess: ____________________A JTextField should be used to input the guess. A JButton must be provided to allow the user topress each time a guess is entered. As each guess is input, the background color should change toeither red or blue. Red indicates that the user is getting warmer, and blue indicates that the user isgetting colder. A JLabel should display either Too High or Too Low to help the user zero in on thecorrect answer. When the user gets the correct answer, Correct! should be displayed, and theJTextField used for input should be cleared and changed to be uneditable. Also, a JButton should beprovided to allow the user to play the game again. When the New Game JButton is clicked, a newrandom number should be generated and the input JTextField changed to be editable. A JButtonmust be provided to allow the user to exit the application. Also provide a count of the number ofguesses the user entered when the correct number is guessed.Grading Rubric GuessGame Points Description Must contain programs name, student name, andStandard header included 1 description of the programProgram compiles 1 Program does not have any errorProgram executes 1 Program runs without any error GUI contains the label with the initial question, the labelGUI contains the required 2 for the input field, and the label for the Too high or Toolabels low messageGUI contains input text field 2 GUI contains the input field for entering the guessfor the guessGUI contains the Guess, New GUI contains the Guess button, New Game button, and 3Game, and Exit buttons Exit buttonEach button handles the Each button handles and processes its correspondingcorresponding events 6 behaviorproperlyProgram displays the correct 4 Program displays the correct messages, changes the
  • 2. output colors appropriately, and displays the count of guesses Subtotal 20STEP 2: Text File I/O (20 points)Write a program called TextFileIO.java to create a file named numbers.dat. Then create analgorithm that writes all even numbered integers from 1 to 100, separated by a comma. After thefile has been created, close and reopen the file and display the results to the screen. After theresults have been displayed append the odd number integers from 1 to 100, separated by a commato the end of the file. Reopen the file and display the results. The contents of the file should be theeven numbers from 1 to 100 separated by a comma followed by the odd number from 1 to 100separated by a comma. The output of this program would be something like the following2,4,6,8,10,12,14,……,98,1002,4,6,8,10,12,14,……,98,100,1,3,5,7,9,……..97,99Grading Rubric Text File I/O Points Description Must contain program’s name, student name,Standard header included 1 and description of the programProgram compiles 2 Program does not have any errorProgram executes 2 Program runs without any errorProgram creates "numbers.dat" file 2 The file numbers.dat exists and is readableProgram writes all even number All even numbers from 1 to 100 are writtenintegers from 1 to 100, separated by 2 to the file. A comma separates each number.commas The file is closed after even numbers areFile is closed 1 processed The file is re-opened for reading the evenFile is re-opened for reading 1 numbers and commas Program displays even numbers from 1 toProgram displays even integers 1 100 separated by commasOdd numbers from 1 to 100 separated Odd numbers from 1 to 100 are appended to 2by commas are appended the file. A comma separates each number. The file is closed after odd numbers areFile is closed 1 processed The file is re-opened for reading the evenFile is re-opened for reading 1 and odd numbers separated by commas
  • 3. The contents of the file are displayedFile contents are displayed 1 correctly, showing each number separated by a comma Program displays the correct output asCorrect output is displayed 5 described above Subtotal 20CLICK HERE TO GET THE SOLUTION !!!!!!!!!!