SlideShare a Scribd company logo
1 of 3
CIS/355 iLab 5 of 6



STEP 1: GuessGame

Write 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 to
press each time a guess is entered. As each guess is input, the background color should change to
either red or blue. Red indicates that the user is getting warmer, and blue indicates that the user is
getting colder. A JLabel should display either Too High or Too Low to help the user zero in on the
correct answer. When the user gets the correct answer, Correct! should be displayed, and the
JTextField used for input should be cleared and changed to be uneditable. Also, a JButton should be
provided to allow the user to play the game again. When the New Game JButton is clicked, a new
random number should be generated and the input JTextField changed to be editable. A JButton
must be provided to allow the user to exit the application. Also provide a count of the number of
guesses the user entered when the correct number is guessed.

Grading Rubric
          GuessGame                 Points                          Description

                                             Must contain program's name, student name, and
Standard header included              1
                                             description of the program

Program compiles                      1      Program does not have any error

Program executes                      1      Program runs without any error

                                             GUI contains the label with the initial question, the label
GUI contains the required
                                      2      for the input field, and the label for the Too high or Too
labels
                                             low message

GUI contains input text field
                                      2      GUI contains the input field for entering the guess
for the guess

GUI contains the Guess, New                  GUI contains the Guess button, New Game button, and
                                      3
Game, and Exit buttons                       Exit button

Each button handles the
                                             Each button handles and processes its corresponding
corresponding events                  6
                                             behavior
properly

Program displays the correct          4      Program displays the correct messages, changes the
output                                      colors appropriately, and displays the count of guesses

                         Subtotal     20



STEP 2: Text File I/O (20 points)

Write a program called TextFileIO.java to create a file named numbers.dat. Then create an
algorithm that writes all even numbered integers from 1 to 100, separated by a comma. After the
file has been created, close and reopen the file and display the results to the screen. After the
results have been displayed append the odd number integers from 1 to 100, separated by a comma
to the end of the file. Reopen the file and display the results. The contents of the file should be the
even numbers from 1 to 100 separated by a comma followed by the odd number from 1 to 100
separated by a comma. The output of this program would be something like the following

2,4,6,8,10,12,14,……,98,100
2,4,6,8,10,12,14,……,98,100,1,3,5,7,9,……..97,99

Grading Rubric
                 Text File I/O                  Points                   Description

                                                         Must contain program’s name, student name,
Standard header included                           1
                                                         and description of the program

Program compiles                                   2     Program does not have any error

Program executes                                   2     Program runs without any error

Program creates "numbers.dat" file                 2     The file numbers.dat exists and is readable

Program writes all even number
                                                         All even numbers from 1 to 100 are written
integers from 1 to 100, separated by               2
                                                         to the file. A comma separates each number.
commas

                                                         The file is closed after even numbers are
File is closed                                     1
                                                         processed

                                                         The file is re-opened for reading the even
File is re-opened for reading                      1
                                                         numbers and commas

                                                         Program displays even numbers from 1 to
Program displays even integers                     1
                                                         100 separated by commas

Odd numbers from 1 to 100 separated                      Odd numbers from 1 to 100 are appended to
                                                   2
by commas are appended                                   the file. A comma separates each number.

                                                         The file is closed after odd numbers are
File is closed                                     1
                                                         processed

                                                         The file is re-opened for reading the even
File is re-opened for reading                      1
                                                         and odd numbers separated by commas
The contents of the file are displayed
File contents are displayed                 1    correctly, showing each number separated by
                                                 a comma

                                                 Program displays the correct output as
Correct output is displayed                 5
                                                 described above

                               Subtotal     20


CLICK HERE TO GET THE SOLUTION !!!!!!!!!!

More Related Content

Featured

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

CIS/355 ilab 5 of 6

  • 1. CIS/355 iLab 5 of 6 STEP 1: GuessGame Write 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 to press each time a guess is entered. As each guess is input, the background color should change to either red or blue. Red indicates that the user is getting warmer, and blue indicates that the user is getting colder. A JLabel should display either Too High or Too Low to help the user zero in on the correct answer. When the user gets the correct answer, Correct! should be displayed, and the JTextField used for input should be cleared and changed to be uneditable. Also, a JButton should be provided to allow the user to play the game again. When the New Game JButton is clicked, a new random number should be generated and the input JTextField changed to be editable. A JButton must be provided to allow the user to exit the application. Also provide a count of the number of guesses the user entered when the correct number is guessed. Grading Rubric GuessGame Points Description Must contain program's name, student name, and Standard header included 1 description of the program Program compiles 1 Program does not have any error Program executes 1 Program runs without any error GUI contains the label with the initial question, the label GUI contains the required 2 for the input field, and the label for the Too high or Too labels low message GUI contains input text field 2 GUI contains the input field for entering the guess for the guess GUI contains the Guess, New GUI contains the Guess button, New Game button, and 3 Game, and Exit buttons Exit button Each button handles the Each button handles and processes its corresponding corresponding events 6 behavior properly Program displays the correct 4 Program displays the correct messages, changes the
  • 2. output colors appropriately, and displays the count of guesses Subtotal 20 STEP 2: Text File I/O (20 points) Write a program called TextFileIO.java to create a file named numbers.dat. Then create an algorithm that writes all even numbered integers from 1 to 100, separated by a comma. After the file has been created, close and reopen the file and display the results to the screen. After the results have been displayed append the odd number integers from 1 to 100, separated by a comma to the end of the file. Reopen the file and display the results. The contents of the file should be the even numbers from 1 to 100 separated by a comma followed by the odd number from 1 to 100 separated by a comma. The output of this program would be something like the following 2,4,6,8,10,12,14,……,98,100 2,4,6,8,10,12,14,……,98,100,1,3,5,7,9,……..97,99 Grading Rubric Text File I/O Points Description Must contain program’s name, student name, Standard header included 1 and description of the program Program compiles 2 Program does not have any error Program executes 2 Program runs without any error Program creates "numbers.dat" file 2 The file numbers.dat exists and is readable Program writes all even number All even numbers from 1 to 100 are written integers from 1 to 100, separated by 2 to the file. A comma separates each number. commas The file is closed after even numbers are File is closed 1 processed The file is re-opened for reading the even File is re-opened for reading 1 numbers and commas Program displays even numbers from 1 to Program displays even integers 1 100 separated by commas Odd numbers from 1 to 100 separated Odd numbers from 1 to 100 are appended to 2 by commas are appended the file. A comma separates each number. The file is closed after odd numbers are File is closed 1 processed The file is re-opened for reading the even File is re-opened for reading 1 and odd numbers separated by commas
  • 3. The contents of the file are displayed File contents are displayed 1 correctly, showing each number separated by a comma Program displays the correct output as Correct output is displayed 5 described above Subtotal 20 CLICK HERE TO GET THE SOLUTION !!!!!!!!!!