Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What grade do you need to get on your final?
#1
With finals rolling around the corner. I wanted to put together a quick program to calculate the grades I would need to get on my final in order to get a certain grade in the class. This will only work if your Final is wieghted for 20% of your grade. I made this more for personal use. But I figure I'll put it out there.

Code:
import java.util.Scanner;
import java.lang.String;
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int currentgrade;
        String wantedgrade;
        System.out.println("************************");
        System.out.println("******Final Finder******");
        System.out.println("********nevets04********");
        System.out.println("************************");

        System.out.print("What is your current grade?(%): ");
        currentgrade = input.nextInt();
        System.out.print("What grade do you want?(A,B,C,D,F): ");
        wantedgrade = input.next();
        if (wantedgrade.contentEquals("A")){
            int neededgrade = currentgrade*4-450;
            neededgrade = neededgrade - (neededgrade*2);
            System.out.print(neededgrade);
            System.out.println("%");
        }
        else if (wantedgrade.contentEquals("B")){
            int neededgrade = currentgrade*4-400;
            neededgrade = neededgrade - (neededgrade*2);
            System.out.print(neededgrade);
            System.out.println("%");
        }
        else if (wantedgrade.contentEquals("C")){
            int neededgrade = currentgrade*4-400;
            neededgrade = neededgrade - (neededgrade*2);
            System.out.print(neededgrade);
            System.out.println("%");
        }
        else if (wantedgrade.contentEquals("D")){
            int neededgrade = currentgrade*4-400;
            neededgrade = neededgrade - (neededgrade*2);
            System.out.print(neededgrade);
            System.out.println("%");
        }
        else if (wantedgrade.contentEquals("F")){
            int neededgrade = currentgrade*4-400;
            neededgrade = neededgrade - (neededgrade*2);
            System.out.print(neededgrade);
            System.out.println("%");
        }
        else {
            System.out.println("Error");

        }


    }

}
Reply


Messages In This Thread
What grade do you need to get on your final? - by nevets04 - 01-06-2010, 07:15 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)