Professional Documents
Culture Documents
Lab - Methods
Lab - Methods
Exercise 1:
Write a program that reads a student’s name together with his or her test scores. The program
should then compute the average test score for each student and assign the appropriate grade.
The grade scale is as follows:
90-100, A; 80-89, B; 70-79, C; 60-69, D; 0-59, F.
Sample Output: The output should be in the following form. Fill the last two columns and the
last line showing the class average. (Output test average and class average with two decimal
places.)
Class Average =
Exercise 2:
Write a java program that creates an array containing a list of 10 email addresses. The content is
entered by the user and only valid emails are accepted (should respect the following format
xxx@xxx.xxx).
The program should then find the domain name that has the maximum number of occurrences.
john@gmail.com
Output : The domain name that has the
geek@free.com maximum number of occurrences is
gmail.com with 4 occurrences.
slimshady@yahoo.com
yoyoyo@gmail.com
yoyo@hotmail.com
xoxo@live.com
java@gmail.com
it@yahoo.com
student@free.com
gg@gmail.com
tbs@tbs.com.tn