Labs
- Write a program that defines two variables: one named
age(for your age) and one namedmi(for your middle initial). Initialize the variables appropriately. Have the program print your first name as a string literal, your middle initial from the variable, your last name as a string literal, the string ": Age: ", and your age from the variable.
(Solution: AgeInitial.java)
- Write a program that defines four variables named
score1,score2,score3, andscore4— one for each of a student's four test scores. Assign appropriate values to the variables. Define another variable namedaveragein the program. Have the program calculate the average of the test scores and assign the result to the variable:Print out the four test scores and the average.average = (score1 + score2 + score3 + score4) / 4;
(Solution: StudentScores.java)