Java – Performance Based Test   Select 4 projects from the choices below and complete the tasks in .java. Save a folder for each project with the file name FinalProject(Question#). For Example: Folder name: FinalProject3 if I select number 3 below. Save both folders into your Java folder to a “FINAL” folder. Your grade for this portion of the final will be based on your knowledge of Java.
  1. Write a program that simulates rolling a pair of dice. You can simulate rolling one die by choosing one of the integers
    1, 2, 3, 4, 5, or 6 at random. The number you pick represents the number on the die after it is rolled.
    The expression

    (int)(Math.random()*6) + 1

    does the computation you need to select a random integer between 1 and 6. You
    can assign this value to a variable to represent one of the dice that are being
    rolled. Do this twice and add the results together to get the total roll. Your
    program should report the number showing on each die as well as the total roll.
    For example: The first die comes up 3 The second die comes up 5 Your total roll is 8

  2. Write a program that asks the user's name, and then greets the user by name. Before outputting the user's name, convert it to upper case letters. For example, if the user's name is Fred, then the program should respond "Hello, FRED, nice to meet you!".


  3. Write a program that helps the user count his money. The program should ask how many dollar bills beginning with $100 down to $1, then how many quarters the user has, then how many dimes, then how many nickels, then how many pennies. Then the program should tell the user how much money he has, expressed in dollars.

  4. If you have N eggs, then you have N/12 dozen eggs, with N%12 eggs left over. (This is essentially the definition of the / and % operators for integers.) Write a program that asks the user how many eggs she has and then tells the user how many dozen eggs she has and how many extra eggs are left over.

    A gross of eggs is equal to 144 eggs. Extend your program so that it will tell the user how many gross, how many dozen, and how many left over eggs she has. For example, if the user says that she has 1342 eggs, then your program would respond with

    Your number of eggs is 9 gross, 3 dozen, and 10

    since 1342 is equal to 9*144 + 3*12 + 10.

  5. Suppose that a file named "testdata.txt" contains the following information: The first line of the file is the name of a student. Each of the next three lines contains an integer. The integers are the student's scores on three exams. Write a program that will read the information in the file and display (on standard output) a message the contains the name of the student and the student's average grade on the three exams. The average is obtained by adding up the individual exam grades and then dividing by the number of exams.

  6. Write a program that will evaluate simple expressions such as 17 + 3 and 3.14159 * 4.7. The expressions are to be typed in by the user. The input always consist of a number, followed by an operator, followed by another number. The operators that are allowed are +, -, *, and /. You can read the numbers with TextIO.getDouble() and the operator with TextIO.getChar(). Your program should read an expression, print its value, read another expression, print its value, and so on. The program should end when the user enters 0 as the first number on the line.

  7. Write an application in which you create an array that holds 10 Books, some Fiction and some NonFiction. Using a for loop, display details about all 10 Books.

  8. Write a Java program to reverse an array of integer values. 

  9. Write a Java program to count the number of prime numbers less than a given positive number. 

  10. Write a Java program to accept a float value of number and return a rounded float value.