Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) create a class and write the following methods: a) int firstDigit(int n), ret

ID: 658934 • Letter: 1

Question

1) create a class and write the following methods:

                  a) int firstDigit(int n), returning the first digit of the argument

                  a) int lasstDigit(int n), returning the last digit of the argument

                  a) int digits(int n), returning the number of digits of the argument

For example, firstDigit(1729) is 1, lastDigit(1729) is 9, and digits(1729) is 4.

Provide a program that tests your methods from a different class in a non static manner.

2) create a class with the method:

                  public static String repeat(String str, int n)

                  that returns the String str repeated n times. For example, repeat("ho", 3) returns hohoho.

Provide a program that tests your methods from a different class in a static manner.

3) Write a program that asks for a password, than asks again to confirm it. If the passwords do not match or the rules are not fulfilled, prompt again. Your program should include a method that checks whether a password is valid.

must be 8 characters long

at least one upper case letter and one lower case letter

at least one digit

4) Implement a class Student. For the purpose of this exercise, a student has a name and a total quiz score. Supply an appropriate constructor and methods getName(), addQuiz(int score), getTotalScore(), and getAverageScore(). To compute the latter, you need to store the number of quizzes the student took.

Write a program that demonstrates the methods for a group of at least 4 students using an ArrayList to hold Student objects.

6) It is a well-known phenomenon that most people are easily able to read a text whose words have two characters flipped, provided the first and last letter of each word are not changed. For example,

                  I dn'ot gvie a dman for a man taht can olny sepll a wrod one way. (Mark Twain)

Write a program with a method scramble(String word) that reads the contents of a file with a paragraph in it and constructs a scrambled version of the paragraph, randomly flipping two characters other than the first and last for all words greater than length 3.

7) A spreadsheet file can be stored as a comma separated file. For instance if a file called data.csv had the following in it:

name, quiz1, quiz2, quiz3, hw1, hw2, hw3, midterm, final

bill,8,9,10,50,45,43,88,93  

jill,9,9,10,50,48,40,90,91  

gill,6,5,7,38,22,40,70,73  

will,8,9,9,40,45,43,83,94  

totals,10,10,10,50,50,50,100,100

It would display in a program like Microsoft excel appropriately.

a) create a file called data.csv with this data on your hard drive.

b) read the file into a program calculating each students final percentage.

c) have the program write a new file with an extra column containing the final percentage for each student, a column heading for the first row, and the last row can end with 100 for its percentage

Explanation / Answer

Please mention the technology in hich the code is needed also mention that if you need screenshot of the output.