SlideShare ist ein Scribd-Unternehmen logo
1 von 3
SOLUTIONJUG.COM
CIS/355 iLab 5 of 6
CLICK HERE TO GET THE SOLUTION !!!!!!!!
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
Standard header included 1
Must contain program's name, student name, and
description of the program
Program compiles 1 Program does not have any error
Program executes 1 Program runs without any error
GUI contains the required
labels
2
GUI contains the label with the initial question, the label
for the input field, and the label for the Too high or Too
low message
GUI contains input text field
for the guess
2 GUI contains the input field for entering the guess
GUI contains the Guess, New
Game, and Exit buttons
3
GUI contains the Guess button, New Game button, and
Exit button
Each button handles the
corresponding events
properly
6
Each button handles and processes its corresponding
behavior
Program displays the correct
output
4
Program displays the correct messages, changes the
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
Standard header included 1
Must contain program’s name, student name,
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
integers from 1 to 100, separated by
commas
2
All even numbers from 1 to 100 are written
to the file. A comma separates each number.
File is closed 1
The file is closed after even numbers are
processed
File is re-opened for reading 1
The file is re-opened for reading the even
numbers and commas
Program displays even integers 1
Program displays even numbers from 1 to
100 separated by commas
Odd numbers from 1 to 100 separated
by commas are appended
2
Odd numbers from 1 to 100 are appended to
the file. A comma separates each number.
File is closed 1
The file is closed after odd numbers are
processed
File is re-opened for reading 1
The file is re-opened for reading the even
and odd numbers separated by commas
File contents are displayed 1
The contents of the file are displayed
correctly, showing each number separated by
a comma
Correct output is displayed 5
Program displays the correct output as
described above
Subtotal 20
CLICK HERE TO GET THE SOLUTION !!!!!!!!
Cis 355 i lab 5 of 6

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

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
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Empfohlen

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
ThinkNow
 
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
Kurio // The Social Media Age(ncy)
 

Empfohlen (20)

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...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Cis 355 i lab 5 of 6

  • 1. SOLUTIONJUG.COM CIS/355 iLab 5 of 6 CLICK HERE TO GET THE SOLUTION !!!!!!!! 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 Standard header included 1 Must contain program's name, student name, and description of the program Program compiles 1 Program does not have any error Program executes 1 Program runs without any error GUI contains the required labels 2 GUI contains the label with the initial question, the label for the input field, and the label for the Too high or Too low message GUI contains input text field for the guess 2 GUI contains the input field for entering the guess GUI contains the Guess, New Game, and Exit buttons 3 GUI contains the Guess button, New Game button, and Exit button Each button handles the corresponding events properly 6 Each button handles and processes its corresponding behavior Program displays the correct output 4 Program displays the correct messages, changes the colors appropriately, and displays the count of guesses
  • 2. 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 Standard header included 1 Must contain program’s name, student name, 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 integers from 1 to 100, separated by commas 2 All even numbers from 1 to 100 are written to the file. A comma separates each number. File is closed 1 The file is closed after even numbers are processed File is re-opened for reading 1 The file is re-opened for reading the even numbers and commas Program displays even integers 1 Program displays even numbers from 1 to 100 separated by commas Odd numbers from 1 to 100 separated by commas are appended 2 Odd numbers from 1 to 100 are appended to the file. A comma separates each number. File is closed 1 The file is closed after odd numbers are processed File is re-opened for reading 1 The file is re-opened for reading the even and odd numbers separated by commas File contents are displayed 1 The contents of the file are displayed correctly, showing each number separated by a comma Correct output is displayed 5 Program displays the correct output as described above Subtotal 20 CLICK HERE TO GET THE SOLUTION !!!!!!!!