SlideShare una empresa de Scribd logo
1 de 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 !!!!!!!!!!

Más contenido relacionado

Destacado

CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6
helpido6
 
A case of synchronous double primary neuroendocrine lung cancer
A case of synchronous double primary neuroendocrine lung cancerA case of synchronous double primary neuroendocrine lung cancer
A case of synchronous double primary neuroendocrine lung cancer
Dragon Yott
 
lesson ( 21) Animals 2
lesson ( 21) Animals 2lesson ( 21) Animals 2
lesson ( 21) Animals 2
Amnah AlBishri
 
Mutasi dan promosi jabatan
Mutasi dan promosi jabatanMutasi dan promosi jabatan
Mutasi dan promosi jabatan
Aditya Canakia
 
Plannnning sheeeet phase one
Plannnning sheeeet phase onePlannnning sheeeet phase one
Plannnning sheeeet phase one
Natasha Jobe
 
Lung tumors lecture
Lung tumors   lectureLung tumors   lecture
Lung tumors lecture
Dragon Yott
 

Destacado (14)

Morocco (Green World)
Morocco (Green World)Morocco (Green World)
Morocco (Green World)
 
CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6CIS/355 ilab 6 of 6
CIS/355 ilab 6 of 6
 
A case of synchronous double primary neuroendocrine lung cancer
A case of synchronous double primary neuroendocrine lung cancerA case of synchronous double primary neuroendocrine lung cancer
A case of synchronous double primary neuroendocrine lung cancer
 
451.full
451.full451.full
451.full
 
lesson ( 21) Animals 2
lesson ( 21) Animals 2lesson ( 21) Animals 2
lesson ( 21) Animals 2
 
CIS/355 ilab 4 of 6
CIS/355 ilab 4 of 6CIS/355 ilab 4 of 6
CIS/355 ilab 4 of 6
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6
 
Mutasi dan promosi jabatan
Mutasi dan promosi jabatanMutasi dan promosi jabatan
Mutasi dan promosi jabatan
 
Plannnning sheeeet phase one
Plannnning sheeeet phase onePlannnning sheeeet phase one
Plannnning sheeeet phase one
 
Lung tumors lecture
Lung tumors   lectureLung tumors   lecture
Lung tumors lecture
 
The Causes of Modern Slavery
The Causes of Modern SlaveryThe Causes of Modern Slavery
The Causes of Modern Slavery
 
1530 wright
1530 wright1530 wright
1530 wright
 
slides de la table-ronde livraison du dernier kilomètre Retail Chain 2015
slides de la table-ronde livraison du dernier kilomètre Retail Chain 2015slides de la table-ronde livraison du dernier kilomètre Retail Chain 2015
slides de la table-ronde livraison du dernier kilomètre Retail Chain 2015
 
694.full
694.full694.full
694.full
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

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 !!!!!!!!!!