ITEC 120 LAB 5 Back to Lab index page

Amazing grade averager

You will write Java program that will average 3 grades input by the user.

You will use the Keyboard class for this project. Download it and put it in a folder called cs1, which needs to be in the same directory as you .java file.

First, your program will ask the user to input what kind of assignment they will be entering grades for. (for example, they might enter test or report or project or quiz). Read this information as a String.

Your program will then prompt the user for 3 of those grades. Read the grades as integers.

Next, your program will average the three grades together, and output that number to one decimal place. (Use the DecimalFormat class to achieve this.)

Sample run:
Program outputs:

Welcome to the amazing grade averager.
Please enter the type of the assignment

User inputs: test
Program outputs: Please enter your score for test number 1:
User inputs: 77
Program outputs: Please enter your score for test number 2:
User inputs: 89
Program outputs: Please enter your score for test number 3:
User inputs: 94
Program outputs:


The average of your 3 test grades is 86.7

Once you have your program working, show your lab to the Peer Instructor to be checked off. You'll run your program a couple times for the Peer Instructor.