Re: My Class assignment help
Do you mind if you actually post the assignment.
Thanks
Re: My Class assignment help
Have a close look at this line:
return (int); numQuizzesTaken;
See anything out of place?
As an aside, why are you casting an int to an int? Isn't that bit redundant and repetitive?
Re: My Class assignment help
Your coding is a little hard to read.... I see your constructor and accessor methods, but where are you mutator methods?
this makes no sense:
public double qScore () {
return (double) totalQuizScore / (int) numQuizzesTaken;
}
public int qTaken;
return (int); numQuizzesTaken;
}
in terms of data types I'm talking about and (double), (int) is not needed...
Re: My Class assignment help
Please use [code=java] before your code and [/code] after your code to keep the formatting and make pretty colors.
What is Name supposed to be in the constructor? Perhaps you meant lname?
In the line:
return (double) totalQuizScore / (int) numQuizzesTaken;
...specifying (double) is useful in getting the correct average but the use of (int) on an int is unnecessary
In the line:
public int qTaken;
...the method's syntax is incorrect. Here is a basic template for a method followed by an example you can look at. 4 of the methods in the posted code have the same problem.
Code :
accessModifier returnType methodName(param1Type param1Name, param2Type param2Name) {
param1Name someWorkWith param2Name
return valueOfReturnType;
}
Code java:
/** Returns the result of multiplying the factors, a fairly useless method commonly used as an example.
*@param factor1 The first factor to be multiplied.
*@param factor2 The second factor to be multiplied.
*@return The result of multiplying factor1 and factor2.
*/
public static int productOf(int factor1, int factor2) {
int result = 0;
result = factor1 * factor2;
return result;
//return factor1 * factor2; //shorthand version
}
string is not the same as String in java source code.
There is a closing bracket missing from the end of the toString method
The line:
System.out.println("Ben Scanlan";
...seems to be missing something