Please Help. These are literally the last points that i have. If i had more, i w
ID: 3549680 • Letter: P
Question
Please Help. These are literally the last points that i have. If i had more, i would give more.
Explanation / Answer
please rate - thanks
if he had 42 points, and took 4 classes, based on what I can figure he now has 42 + 4 or 46 points, which is a sophmore, not a junior. I based the age on 2014-birth year, since it's not specific
had a 3.82 GPA with with 42 classes, thats 42*3.82 points = 160.44 pts
now has 46 classes 2 A+2B = 14 pts 160.44+14=170.44
170.44/46=3.79 new GPA not 3.66.
If you can explain to me where those numbers come from I'll make the changes
Did the best I could, with the insufficient information.
Please don't make me feel I wasted my time and rate
Thanks
import java.util.*;
import java.io.*;
public class GPA
{public static void main(String[] args)throws FileNotFoundException
{Scanner in=new Scanner(new File("input.txt"));
Scanner kb=new Scanner(System.in);
String name,major,buffer;
char gender;
int age,currentClass,birth,count,i;
char grade;
double currentGPA,currentPoints;
name=in.nextLine();
gender=in.next().charAt(0);
birth=in.nextInt();
age=2014-birth;
in.nextLine(); //skip enter
major=in.nextLine();
currentClass=in.nextInt();
currentGPA=in.nextDouble();
System.out.println("Data input "+ name);
System.out.println("Gender: "+gender);
System.out.println("Birth Year: "+birth);
System.out.println("Major: "+major);
System.out.println("Classification: "+currentClass);
System.out.println("GPA: "+currentGPA);
System.out.print("How many classes did "+name +" take this semester? ");
count=kb.nextInt();
kb.nextLine(); //skip enter
currentPoints=currentGPA*currentClass;
for(i=0;i<count;i++)
{System.out.print("enter class "+(i+1)+" name - grade: ");
buffer=kb.nextLine();
grade=buffer.charAt(buffer.indexOf('-')+1);
if(grade<'A'||grade>'F'||grade=='E')
{System.out.println("grade must be A, B, C, D, or F");
i--;
}
else
currentPoints+=getPoints(grade);
}
currentClass+=count;
PrintStream out=new PrintStream(new File("output.txt"));
out.println(name);
if(gender=='M')
out.println("Male");
else
out.println("Female");
out.println(age);
out.println(major);
if(currentClass<=24)
buffer="Freshman";
else if(currentClass<=48)
buffer="Sophmore";
else if(currentClass<=72)
buffer="Junior";
else
buffer="Senior";
out.println(buffer);
out.printf("%.2f ",currentPoints/currentClass);
out.close();
}
public static int getPoints(char grade)
{char g[]={'A','B','C','D'};
int pts[]={4,3,2,1};
int i;
for(i=0;i<g.length;i++)
if(grade==g[i])
return pts[i];
return 0;
}
}