double newGpa2= 4.0;
while(!(newGpa2<2.0)){
if(newGpa2==3.7 || newGpa2 ==2.7){
System.out.println("If your grade is an A- or a B- your gpa is " + Math.abs(newGpa2-0.4));
}
else if(newGpa2 ==4.0 || newGpa2 == 3.3 ||newGpa2== 3.0 || newGpa2 == 2.3 || newGpa2 ==2.0){
System.out.println("If your grade is an A,B+,B,C+ or C your gpa is " + Math.abs(newGpa2-0.3));
the problem is this:
Use a loop to find the effect on the student's GPA for each possible grade in CS201. A corresponds to 4 grade points, A- to 3.7, B+ to 3.3, B to 3, B- to 2.7, C+ to 2.3, and C to 2.0. Do not use the letter grades, only the numeric values. Use a while or do...while loop containing if/else code that decrements the grade by 0.3 if it was 4.0, 3.3, 3.0, or 2.3 or decrements it by 0.4 if it was 3.7 or 2.7.
Aucun commentaire:
Enregistrer un commentaire