Your instructor will assign one or more of the following problems. Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files.
NOTE: If two or more scores tie for the highest score, you may print any two correct names that achieved the highest score.Please enter the number of students: 5 Please enter name and score number 1: John 37 Please enter name and score number 2: Sarah 39 Please enter name and score number 3: David 23 Please enter name and score number 4: Betsy 34 Please enter name and score number 5: Elizabeth 35 The highest score was 39 by Sarah. The second highest score was 37 by John.
Please enter the desired difference between squares: 10 1 4 9 16 25 36Note: No more than 10 squares should be printed on any line.
Write a console driver program that asks the user how many test scores they have, and then reads that many test scores, averages them, and displays the average and a pass/fail grade appropriate for that average (passing is 60% or higher, failing is below 60%). The pass/fail determination should be done in a separate method from the driver.
Proceed as in the previous exercise, but instead of displaying a pass/fail grade, the program should compute a "normal" letter grade (90-100 = A, 80-89 = B, 70-79 = C, 60-69 = D, <60 = F).
Write a "password protection" method that you can use to guard your programs. When called, this method should ask the user for a password. It should allow the user N tries at entering the correct password, where N is a value received from its caller. If the user enters the correct password, the method returns control to its caller, where execution proceeds as normal. If the user fails to enter the correct password after N tries, then the method should use System.exit(1) to terminate the program. Write a driver (i.e. main method) to test it out.
Write two methods:
sum(n)
that computes the value (1 + 2 + ... + (n-1) + n)factorial(n)
that computes (1 * 2 * ... * (n-1) * n)
Your methods can assume that the value of
n
is positive and not too large.
Include a main method that allows the user to specify the number of times she wants to run your computations and
asks the user to specify which computation to execute on each round.
Please enter a positive integer: 91827 91827 reversed is 72819
Name your program Reverse.java.
Consider using the %
operator to extract digits, and the /
operator to remove the extracted digit.
For instance, to extract 4 from 234, use 234 % 10
, and then use 234 / 10
to remove the 4.
Enter as many int values as you'd like (the program exits if the input is 0): 1 2 -1 3 0 The number of positives is 3 The number of negatives is 1 The total is 4 The average is 1.25Name your program SimpleStats.java. You may want to begin by computing the total of the numbers entered, and then add each additional statistic one at a time.
Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files. We will grade this exercise according to the following criteria:
If you work in teams for this homework assignment, be sure to submit all team members’ names in the code documentation.