Self-Test 1
Wed, Oct. 27 2010
(Scanner, String)
Exercise 1:
Write a program called CalculateGrade
to calculate a student's final course grade. Your program should
prompt the user for each line of data in the following format:
firstName lastName
hw1 hw2 hw3 (3 homework scores given as percents)
exam grade (percent score)
- The average of the 3 homework assignments is worth 60% of the
final course grade, and the exam
is worth 40%
- Use constants
for the weights (.6 and .4) and for the number of homework
assignments (3).
- Calculate the student's final grade as a percentage.
- Print your output in the following format:
lastname, firstName : final grade %
For example, if the input is:
Bob Smith
95 85 88.5
91.5
the output should be:
Smith, Bob :
90.3%
Math refresher:
The formula for computing the final grade looks like this: (hwAverage *
HW_WEIGHT) + (examGrade * EXAM_WEIGHT)
Exercise 2:
English words can be translated into a language "pig latin" by
moving the first letter of the word to the end of the word and adding
"ay".
For example, "Happy Halloween" in pig latin is: "Appyhay
Alloweenhay"
Write a program called PigLatin
that asks the user for their first and last name and prints their full
name in pig latin. Don't forget to capitalize the first letter of
the first and last names - the rest of the name should be lowercase.