Welcome to Dream.In.Code
Become a Java Expert!

Join 149,499 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,385 people online right now. Registration is fast and FREE... Join Now!




Need help!

 
Reply to this topicStart new topic

Need help!

bhaktak
25 Mar, 2007 - 03:14 PM
Post #1

New D.I.C Head
*

Joined: 25 Mar, 2007
Posts: 1


My Contributions
CODE

ublic class CalculateGrade
{
    
public classType[][] Grades;
public int[] numClasses;



public CalculateGrade(){
    Grades = new classType[4][8];
    numClasses = new int[4];
    
}

public void edit(){

    System.out.println("Which year is this? 0-freshman 1-sophomore 2-Junior 3 Senior");
    int year = keyboard.readInt();
    System.out.println("Enter how many classes you have");
    numclasses[year]=keyboard.readInt();
    
    
    String classname;
    int grade;
    int totalpoints;
    
    for(int x=0; x<numclasses[year];x++)
    {
        System.out.println("Enter Your classes");
        System.out.println("Enter the class name");
        
        Grades[year][x]= new classType(classname,grade,totalpoints);
        
    
    }
    
        
printMenu();
int choice = keyboard.readInt();
while(choice!=0)
{
dispatch(choice);
printMenu();
choice = keyboard.readInt();
}
}
public static void printMenu(){
    System.out.println("What would you like to do? Press 1 to EDIT CLASSES, Press 2 to VIEW GPA/GRADES, PRESS 3 TO ENTER GRADES");    
    
}

public static void dispatch(int choice)
{
ConsoleIO keyboard = new ConsoleIO();
int loc;
switch(choice)
{
case 0:
break;
case 1:
    System.out.println("Edit your classes");
    student.edit();
case 2:
    System.out.println("Enter your grades");
    student.editgrades();
case 3:
system.out.println("View your GPA");
    student.viewgrades();
    

    public void editgrade(){
    
    System.out.println("Which grade would you like to enter grades for? 0-freshman 1-sophomore 2-Junior 3 Senior");
    int year=keyboard.readInt();
    
    System.outprintln("Which class would you like to enter grades for(enter classname)?");
    int x=keyboard.readInt();
    System.out.println("how many sets of grades would you like to enter");
    
    int gradesets=keyboard.readInt();
    int totalpoints=0;
    int totalpointsavailable=0;
    for(int numenters=0;numenters<=gradesets;numenters++)
    {
        System.outprintln("Please enter how many points the assignment was out of");
        int pointsavailable=keyboard.readInt();
        System.out.println("How many points did you get on the assignment");
        pointsgotten=keyboard.readInt();
         totalpoints+=pointsgotten;
         totalpointsavailable+=pointsavailable;
   //adds the grades that have been entered to the total points
    }
    Grades[year][period].updatepoints(totalpoinsavailable);
    //stores the new totalpoints for that specific class chosen
    
    
printMenu();
int choice = keyboard.readInt();
while(choice!=0)
{
dispatch(choice);
printMenu();
choice = keyboard.readInt();
}
}
public static void printMenu(){
    System.out.println("What would you like to do? Press 1 to EDIT CLASSES, Press 2 to VIEW GPA/GRADES, PRESS 3 TO ENTER GRADES");    
    
}

public static void dispatch(int choice)
{
ConsoleIO keyboard = new ConsoleIO();
int loc;
switch(choice)
{
case 0:
break;
case 1:
    System.out.println("Edit your classes");
    student.edit();
case 2:
    System.out.println("Enter your grades");
    student.editgrades();
case 3:
system.out.println("View your GPA");
    student.viewgrades();
    
public void viewgrades{
{
    Grades[year][x]=(totalpoints/totalpointsavailable);
    if(Grades[year][x]>=90.000)
    {
        int GPApoints=4;
        int totalgpapoints+=GPApoints;
    }
    else(Grades[year][x]>=80.000)
    
        GPApoints=3;
        int totalgpapoints+>GPApoints;
    
    else(Grades[year][x]>=70.000)
    
        GPApoints=2;
        int totalgpapoints+=GPApoints;
    
    else(Grades[year][x]>=60.000)
    
        GPApoints=1;
        int totalgpapoints+=GPApoints;

    else(Grades[year][x]>=0.000)
    
         GPApoints=0;
        int totalgpapoints+=GPApoints;
        //from the division of totalpointsgotten/totalpointsavailable the percent is found to give gpa points which are added in the for loop to the totalGPA points
        
double GPA=(double)totalgpapoints/numclasses;
//this takes total gpa points and divides them by the numclasses which the user entered
Grades[year][period].updatepoints(totalgpapoints);

System.out.print("Your GPA is"+ GPA);
}

    
            }

printMenu();
int choice = keyboard.readInt();
while(choice!=0)
{
dispatch(choice);
printMenu();
choice = keyboard.readInt();
}

public static void printMenu(){
System.out.println("What would you like to do? Press 1 to EDIT CLASSES, Press 2 to VIEW GPA/GRADES, PRESS 3 TO ENTER GRADES");    
    
}

public static void dispatch(int choice)
{
ConsoleIO keyboard = new ConsoleIO();
int loc;
switch(choice)
{
case 0:
break;
case 1:
    System.out.println("Edit your classes")
    student.edit();
case 2:
    System.out.println("Enter your grades")
    student.editgrades();
case 3:
system.out.println("View your GPA")
    student.viewgrades();
    }
}
    
    
    
    




    






I need to calculate grades using useres input of assignment points

Example

55/59
then add it to total points out of a speiific classes grades that the user has chosen.

If the user chooes view grades, these points will be used to calculate GPA from grades.
User is offlineProfile CardPM
+Quote Post

DilutedImage
RE: Need Help!
25 Mar, 2007 - 06:39 PM
Post #2

D.I.C Addict
Group Icon

Joined: 20 Nov, 2006
Posts: 643



Thanked: 6 times
Dream Kudos: 25
My Contributions
Cool. Do you have a question regarding that? Is there a portion you're needing help with? Or ... ??
User is offlineProfile CardPM
+Quote Post

skyhawk133
RE: Need Help!
25 Mar, 2007 - 06:48 PM
Post #3

Head DIC Head
Group Icon

Joined: 17 Mar, 2001
Posts: 15,262



Thanked: 61 times
Dream Kudos: 1650
Expert In: Web Development

My Contributions
Someone didn't read the big red letters:

QUOTE
I have done the following before posting a new topic:
- Searched for my problem using the search box on the right
- Given my thread a descriptive title (Not "Help", "Homework Problem", etc.)
- Put [code]code here[ /code] tags around my code
- Included any errors and a description of my problem


But thank you for putting your code in [code] tags!
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 06:24PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month