JAVA Project 1
Random Number Guessing Game
Write a program that generates a random number and asks the user to guess what the number is. If the users guess is higher than the random number, the program should display Too high, try again. If the users guess is lower than the random number, the program should display Too low, try again. The program should use a loop that repeats until the user correctly guesses the random number.
JAVA Project 2
Write a program that plays a simple dice game between the computer and the user. When the program runs, a loop should repeat 10 times. Each iteration of the loop should do the following:
- Generate a random integer in the range of 1 through 6. This is the value of the computers die.
- Generate another random integer in the range of 1 through 6. This is the value of the users die.
- The die with the highest value wins. In case of a tie, there is no winner for that particular roll of the dice.
As the loop iterates, the program should keep count of the number of times the computer wins, and the number of times that the user wins. It should also display the results of each roll.
After the loop performs all of its iterations, the program should display who was the grand winner: the computer or the user.
JAVA Project 3
Employee Class
Write a class named employee with the following fields:
# name. The name field references a String object that holds the employees name.
# idNumber. The idNumber is an int variable that holds the employees ID number.
# department. The department field rerences a String object that holds the name of the department where the employee works.
# position. The position field references a String object that holds the employees job title.
The class should have the following constructors:
-A constructor that accepts the following values as arguments and assigns them to the appropriate fields: employees name, employees ID number, department, and position.
-A constructor that accepts the following values as arguments and assigns them to the appropriate fields: employees name and ID number. The department and position fields should be assigned an empty string(**).
-A no-arg constructor that assigns empty strings (**) to the name, department, and position fields, and 0 to the idNumber field.
Write appropriate mutator that store values in these fields and accessor methods that return the values in those fields. Once you have the class, write a separate program that creates three Employee objects to hold the following data:
Name : Susan Meyers Mark Jones Joy Rogers
ID Number : 47899 39119 81774
Department : Accounting IT Manufacuturing
Position : vice Pres. Programmr Engineer
The program should store this data in the three objects and then display the data for each employee on the screen.
Reviews
There are no reviews yet.