|
Re: Using Java to Calculate Semester Hours
|
Posted: May 12, 2003 10:40 PM
|
|
INSTRUCTION
Use the following data for your calculations: COURSE - GRADE - CREDITS EARNED
MMIS 650 - Grade = "D" - 0 credits MMIS 670 - Grade = "A" - 4 credits MMIS 692 - Grade = "C" - 3 credits MMIS 700 - Grade = "B+" - 3 credits MMIS 800 - Grade = "F" - 0 credits MMIS 540 - Grade = "B" - 4 credits
A = 4, B+ = 3.5, B=3, C=2, D=1, F=0 Write a java program that will output the following information : ******************************************************** First Name: Your First Name Last Name: Your Last Name GPA: Calculate using the data above Num Credits Earned At NSU: Calculate using the data above
***TO Compile the program, I am using Ready to Program, software designed by Holt Software Associate.
Code use to generate the following output: First Name, Last Name, GPA, Credit at NSU(can't get that to work, i thougth if I added the grades and divide them,I should be able to get answer, but I get an error)
//Emmanuel Michel
public class assign2_example { public static void main(String[] args) {
int mmis_650 = 1; int mmis_670 = 4; short mmis_692 = 2; double mmis_700 = 3.5;// use double because 3.5 is floating-point number int mmis_800 = 0; int mmis_540 = 3; double number_courses = 6; String last_name = new String ("Michel"); String first_name = new String ("Emmanuel"); double gpa = ((mmis_650 + mmis_670 + mmis_692+ mmis_700 + mmis_800 + mmis_540 ) / number_courses); System.out.println("MMIS 650 " + mmis_650); System.out.println("MMIS 670 " + mmis_670); System.out.println("MMIS 692 " + mmis_692); System.out.println("MMIS 700 " + mmis_700); System.out.println("MMIS 800 " + mmis_800); System.out.println("MMIS 540 " + mmis_540); System.out.println(""); System.out.println("GPA " + gpa); System.out.println(""); System.out.println ("Last Name : " + last_name); System.out.println ("First Name: " + first_name); } }
When I run the program, it generate the following output, I copied and paste it.
MMIS 650 1 MMIS 670 4 MMIS 692 2 MMIS 700 3.5 MMIS 800 0 MMIS 540 3
GPA 2.25
Last Name : Michel First Name: Emmanuel
The problem is, I need to also to include the code to have it output the number credit of 14
|
|