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

  Given an array with 100,000 entries to sort

Sorting  given an array with 100,000 entries to sort. Under what circumstances would you use each of the following: insertion sort,mergesort'quicksort

  Part-2write a program that will perform some of the basic

part-2write a program that will perform some of the basic tasks accomplished by a file integrity checker such as

  Describe the project requirements and other assumptions

Summarize the project requirements and other assumptions (i.e., budget, human resources, workload, environmental dependencies, etc.). Define a work breakdown structure and describe the methodology behind constructing one

  How many tickets for each class of seats were sold

Prepare a program that asks how many tickets for each class of seats were sold, then shows the amount of income generated from ticket sales.

  Instance methods

instance methods: setWidth(double w), setHeight(double h), double getWidth(), double getHeight() and double getArea() * A triangle's area is calculated by width*height*0.5  * all variables are private and methods public.

  Implement a client program

Implement a client program with a main method to demonstrate the evolution of the sales tax rates in the 50 US states over the last 10 years. Declare a two-dimensional array of values representing the sales tax rates. Dimension 1 represents the st..

  Implement a thread for each creature representing a task

Implement a threads and a GUI interface using advanced Java Swing classes.

  Bulloil company is planning a large pipeline from east to

bulloil company is planning a large pipeline from east to west x-axis across its oil fieldbullthe field has n

  Calculates the cost of a mortgage

Write a class called Mortgage that calculates the cost of a mortgage. Prompt the user to enter the principal amount, the term in years, and the interest rate per year.

  Write down a java program which prints out all 92 solutions

write a java program which prints out all 92 solutions of the 8-queen problem but modify the program to display only

  Prepare an address book to save the complete information

Prepare an address book to save the complete information of the person - Define the class Address that can store a street address, city, state, and zip code. Use the appropriate methods to print and store the address.

  Create a non-gui based java application

Create a non-GUI based Java application that calculates weekly pay for an employee. The application should display text that requests the user input the name of the employee.

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