Scenario and summary | Computer Science homework help

  

Scenario and Summary 

 In this lab you will create a single program that creates and reads a sequential file.

  

Deliverables

Program files for each of the following two programs

  1. GuessGame 
  2. Text File I/O 

At the beginning of ALL your programs, put a comment box that includes the program name, your name, and a brief description of the program. 

Example: 

/***********************************************************************
Program Name: ProgramName.java
Programmer’s Name: Student Name
Program Description: Describe here what this program will do
***********************************************************************/ 

How to submit your assignment: 

  1. The programs MUST have the same names as the assignment      title. 
  2. Each Java source file (*.java) must include a      corresponding class file (*.class) program as evidence of success. 
  3. In addition to the program source code files and byte      code files, put all your program source code files and screen shots of      your program output files into a Word document. 
  4. You must use a zipped folder to send your weekly      assignment to the Dropbox. Do not send subfolders within your zipped      folder. Place ALL of the .java and .class files for the week into the one      zipped folder. The zip folder should be named:      CIS355A_YourLastName_iLab_Week5, and this zip folder will contain all the      weekly programming assignments.

  

i L A B S T E P S 

  

STEP 1: GuessGame (20   points)

Back to Top

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–100 The program then displays the following in a label.

I have a number between 1 and 100 — 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)

Back to Top

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 

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more