For the project I need to have two classes (student and Grades). Im working on the student class and it isnt running any of the code that I have written. I feel like i am missing something really dumb. I am requesting the first and last name of the student and their grades. The program should then print the name and the grades with the overall grade. yet its not printing anything and it isnt even requesting user input.
Please let me know what I am doing wrong. any help would be greatly appreciated.
import java.util.Scanner;
/** this class sets the information for the student
*
* @author
*
*/
public class Student
{
//Holds the name of the student
private String name;
//holds the grades
private int examGrade;
private int programGrade;
public static void main(String[] args)
{
Student name = new Student();
}
/**sets all attributes of the student
*
*/
public void setup()
{
}
/**sets the name of the student
*
* @param someName
*/
private void setName(String someName)
{
//initializes user input
Scanner keyboard = new Scanner(System.in);
//requests and sets last name
System.out.println("Please enter students last name:");
String lastName = keyboard.toString();
//requests and sets students first name
System.out.println("Please enter students first name:");
String firstName = keyboard.toString();
//sets someName in first and last order
someName = firstName + " " + lastName;
//sets someName to name
name = someName;
}
/**sets the grades for the student
*
*/
private void setGrades()
{
Scanner keyboard = new Scanner(System.in);
//requests and sets grades
System.out.println("Please enter " + "'s program and exam grades:");
programGrade = keyboard.nextInt();
examGrade = keyboard.nextInt();
}
/**displays the complete information on the student
*
*/
public void display()
{
System.out.println(name + " has grades of " + examGrade + ", " + programGrade + ".");
}
/**returns the overall grade of the student
*
* @return
*/
public double overallGrade()
{
final double PROGRAM_WEIGHT = 0.40;
final double EXAM_WEIGHT = 1 - PROGRAM_WEIGHT;
double theOverallGrade;
theOverallGrade = programGrade * PROGRAM_WEIGHT + examGrade * EXAM_WEIGHT;
return theOverallGrade;
}
}

New Topic/Question
Reply


MultiQuote






|