Comp 151 Project 2

Using Arithmetic and basic Java I/O


You will use your knowledge of Arithmetic and reading from and writing to the command line in Java that you learned from lecture and from chapter 2 and apply them to this simple lab.

This lab is long enough that many of you will have to work on it for a couple of iterations so I encourage you to start early.

Due: Friday Sept 24th at 11:59pm


Create a new project in eclipse as a before. Name this one again using your first initial and last name and then Lab2. So mine would be jsantoreLab2

Again add a new class to your project in eclipse. Call this class Lab2

Your class should do the following. (your main job is to figure our how to write the code to do this.) I encourage you to look at code listing 2-27 on pages 89-90 of your book ( from the Chapter 02 folder in the sourcecode from the cd in the back of you book). This program is quite similar, though not exactly the same and the one you will do.

This lab will be a simple GPA calculator for a student with three classes.

Hint: you will need at least 7 unique variables for this lab, one for the name, then one for each class's credits (for a total of three more) and one the grade points for each class(three classes so you need three more here)

your design might also need an eight variable for the output string.

An example run on the program might look like this:

What is your name: John
How many credits is your first class worth: 4
What was your grade in that class: 3.0
How many credits is your second class worth: 3
What was your grade in that class: 4.0
How many credits is your third class worth: 3
What was your grade in that class: 3.3

John your GPA for this semester is 3.39

If you are using as a guide for this project as I suggested earlier, be aware that this project is slightly longer than that one. Expect to have anywhere from 1.5 to 2 times the code of that project.


again zip up your project folder and submit it to me by email. Make sure that your submitted zip file contains your first initial and last name as part of the zip file name.