Results 1 to 3 of 3

Thread: Calc GPA II

  1. #1
    Ibro is offline Member
    Join Date
    Oct 2013
    Posts
    1
    Rep Power
    0

    Default Calc GPA II

    i want to prompt the student to enter any grade between A-F and the program automatically prints the CGPA. I wellcom all constructive suggestions please.Thanks


    import java.util.Scanner;

    public class Cgpa_Switch {
    public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    String credit_hours;

    System.out.println("Enter the total credit hour i.e units");
    }
    double Gpa, Cgpa, phygpa, Enggpa, Biogpa, chemgpa, compScigpa;
    String Phy, Eng;
    static String Bio;
    String chem, compSci;
    }
    switch(Phy)
    {

    case"A" :
    Gpa=5.0;
    break;
    case "B" :
    Gpa=4.0;
    break;
    case "C":
    Gpa=3.0;
    break;
    case "D":
    Gpa=2.0;
    break;
    case "E":
    Gpa=1.0;
    break;
    case "F":
    Gpa=0.0;
    break;
    System.out.println("Physics gpa = " +phygpa);
    //calculate gpa of Eng

    switch(Eng){

    case"A" :
    Gpa=5.0;
    break;
    case "B" :
    Gpa=4.0;
    break;
    case "C":
    Gpa=3.0;
    break;
    case "D":
    Gpa=2.0;
    break;
    case "E":
    Gpa=1.0;
    break;
    case "F":
    Gpa=0.0;
    break;
    System.out.println("English gpa = " +phygpa);
    //calculate biology gpa
    switch(Bio){

    case"A" :
    Gpa=5.0;
    break;
    case "B" :
    Gpa=4.0;
    break;
    case "C":
    Gpa=3.0;
    break;
    case "D":
    Gpa=2.0;
    break;
    case "E":
    Gpa=1.0;
    break;
    case "F":
    Gpa=0.0;
    break;
    System.out.println("biology gpa = " +phygpa);

    //calculate chem gpa
    switch(Chem){

    case"A" :
    Gpa=5.0;
    break;
    case "B" :
    Gpa=4.0;
    break;
    case "C":
    Gpa=3.0;
    break;
    case "D":
    Gpa=2.0;
    break;
    case "E":
    Gpa=1.0;
    break;
    case "F":
    Gpa=0.0;
    break;
    System.out.println("chem gpa = " +Biogpa);

    // calculate computer science gpa
    switch(phy){

    case"A" :
    Gpa=5.0;
    break;
    case "B" :
    Gpa=4.0;
    break;
    case "C":
    Gpa=3.0;
    break;
    case "D":
    Gpa=2.0;
    break;
    case "E":
    Gpa=1.0;
    break;
    case "F":
    Gpa=0.0;
    break;
    System.out.println("Physics gpa = " +compScigpa);


    phygpa*=4;
    Enggpa*=3;
    Biogpa*=3;
    chemgpa*=3;
    compScigpa*=4;

    cgpa = ((phyGpa+EngGpa+CalGpa+IslmGpa+IntroGpa)/Credit_Hour);
    }
    System.out.println("The total grade point is" + cgpa);
    }

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,358
    Rep Power
    6

    Default Re: Calculate GPA

    Create your own thread in stead of hijacking a zombie thread. And use code tags to format your code; the advanced post editor has a button for that.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,901
    Rep Power
    25

    Default Re: Calc GPA II

    Please edit your post and wrap your code with code tags:
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Problem with Taxes in Payroll Calc
    By thoed_e in forum New To Java
    Replies: 4
    Last Post: 08-12-2013, 08:52 PM
  2. could not find or load main class calc.Calc
    By doomking517 in forum New To Java
    Replies: 5
    Last Post: 06-12-2013, 10:45 PM
  3. need help postfix calc
    By b3222 in forum Advanced Java
    Replies: 1
    Last Post: 03-13-2012, 12:05 AM
  4. Help with Square root function and Overload(calc error)
    By racingoutbac in forum New To Java
    Replies: 3
    Last Post: 11-04-2010, 01:09 AM
  5. Investment Calc
    By rfore1 in forum New To Java
    Replies: 13
    Last Post: 02-28-2010, 07:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •