Re: Some help with boolean
What are courseworkPercentage and examPercentage? Where are they defined with respect to this function?
Re: Some help with boolean
Quote:
Originally Posted by
copeg
What are courseworkPercentage and examPercentage? Where are they defined with respect to this function?
Sorry! Here's my code so far.....it's not that big so maybe you could help me :cool:
Code Java:
import java.util.*;
public class StudentInGradeBook {
String lastName, firstName;
int studentId;
double courseworkGrade, examGrade, Grade;
static double courseworkPercentage, examPercentage;
public StudentInGradeBook (int I, String L, String F) {
studentId = I;
lastName = L;
firstName = F;
}
public StudentInGradeBook() {
studentId = 0;
lastName = "Not defined";
firstName = "Not defined";
}
public void setCourseworkGrade (double courseworkGrade) {
courseworkGrade = courseworkGrade;
}
public void setExamGrade (double examGrade) {
examGrade = examGrade;
}
public int getStudentId() {
return studentId;
}
public String getLastName() {
return lastName;
}
public String getFirstName() {
return firstName;
}
public double getCourseworkGrade() {
return courseworkGrade;
}
public double getExamGrade() {
return examGrade;
}
public double getGrade() {
return Grade;
}
public double getCourseworkPercentage() {
return courseworkPercentage;
}
public double getExamPercentage() {
return examPercentage;
}
public double calcGrade;{
Grade = (courseworkGrade * courseworkPercentage/100) + (examGrade * examPercentage/100);
}
static Scanner console = new Scanner(System.in);
public boolean setPercentages(int A, int B) {
A = console.nextInt();
B = console.nextInt();
if (A + B == 100) {
return true;
}
else {
return false;
}
}
}
Re: Some help with boolean
First, a question for you. Why are courseworkPercentage and examPercentage declared static? Do you really want them to have the same value for all instances of the class?
db