Java swing components and file processing

Assignment Help JAVA Programming
Reference no: EM13765362

Java Swing Components and File Processing:

Program files for each of the following three programs.

1. GuessGame

2. Text File I/O

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.

Step 2: Text File I/O

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

Reference no: EM13765362

Questions Cloud

Monopolists are less elastic at all levels of output : In contrast to firms operating in purely competitive industries, demand curves faced by monopolists are less elastic at all levels of output
What elements must be in place for formation of a contract : What elements must be in place for formation of a contract? The Uniform Commercial Code generally regulates commerce or trade on a national basis
Question regarding the right of return : Gyro Company is presently testing a number of new weed control products that it recently developed. To stimulate interest, it has decided to grant to five of its largest customers the unconditional right of return to these products if not fully sa..
Paper detailing the role of corrections officials : Roles of Corrections Officers. Prepare a paper detailing the role of corrections officials
Java swing components and file processing : Java Swing Components and File Processing, 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..
Revenue recognition on book sales with high returns : Chester Books Co. publishes romance novels that are sold to bookstores on the following terms. Each title has a fixed wholesale price, terms f.o.b. shipping point, and payment is due 90 days after shipment. The retailer may return a maximum of 20%..
Latest software and technology : Research the latest software and technology trends surrounding 3D printers. Focus your research on the growth of the 3D printing market. Be prepared to discuss.
Paper detailing the role of corrections officials : Roles of Corrections Officers. Prepare a paper detailing the role of corrections officials
Revenue recognition on book sales with high returns : Chester Books Co. publishes romance novels that are sold to bookstores on the following terms. Each title has a fixed wholesale price, terms f.o.b. shipping point, and payment is due 90 days after shipment. The retailer may return a maximum of 20%..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Program will read parameters plaintext and ciphertextfrom

Specifically, your program will read parameters, plaintext and ciphertextfrom a file named "input.txt" (under the same directory).Then your program needs tocreate a file named "output.txt" (under the same directory) and prints the public key, private..

  Create a program that develops an amortization schedule

Create a program that develops an amortization schedule. Your program should be written as a Java applet.

  Program to track hourly employee arrival and departure time

THE JAVA SOURCE CODEA company hires you to write a program to track hourly employee arrival and departure times from work. In essence, you are tasked to make an online time clock. The time clock shall keep a history of an employee’s hours for a two-w..

  The menu is displayed and the user must select

The menu is displayed and the user must select an option (a number between 0 and 7). The action corresponding to the selection is performed, then the menu is displayed again and the user can choose another option.

  Create a class for services offered by a hair-styling salon

Create a class for services offered by a hair-styling salon. Data fields include a String to hold the service description and write an application named Salon Report that contains an array to hold six Service objects and fill it with the data

  The following program will display an integral solution

The following program will display an integral solution to the quadratic equation ax2+bx+c for integral values of a,b, and c, where a,c fall between 0 and 10, while b falls between 1 and 1000.

  Write a recursive program

Write a recursive program to compute the number of ways in which an integer k can be written as sum

  Write a code fragment that would printout the multiplication

Write a code fragment that would printout the multiplication table for the number 3 multiplied by (1-10) .

  Find how many strings in a have exactly three 5s

Let A be the set of all strings of decimal digits of length five. For example, 00312, 99999, and 19483 are strings in A.

  Application named arithmeticmethods

Create an application named ArithmeticMethods whose main() method holds two integer variables. Assign values to the variables. In turn, pass each value to methods named displayNumberPlus10()

  Write an application that displays all even numbers

Write an application that displays all even numbers from 2 to 100 inclusive, and that starts a new line after every multiple of 20 ( 20, 40, 60, and 80). Save the file as EvenNums. java

  Write a method in java that uses a switch statement

Write a method in JAVA that uses a switch statement and takes a person's age using an integer parameter , then checks if the age is valid (0-110), and then RETURNS a string based on the age

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd