Hi guys.. was just wandering if anybody could lend me some quick help on a small java application that I have to compile for an assignment.
I have to copy the following code into a compiler (we use JCreator with the JDK 1.6).. and see what the program does.. however when I do this, i am getting "class, interface, or enum expected" errors on lines 1, 6, 7, 9, 10-13, 15-18. Heres the code....
public static void main(String[] args) {
// Declarations
// Note: If the last 4 digits of your ID begin with 0's
// then drop those. For example: 0035 would become just 35
double birthDay = 20;
double birthMonth = 4;
double studentID = 5246;
//Calculations
birthDay = birthDay * birthMonth * 100
studentID = studentID / birthMonth;
birthDay = 1 + (birthDay % birthMonth);
studentID = studentID - birthDay + (birthMonth * 7);
studentID = studentID + (birthDay * birthMonth);
//Display Results
System.out.println("The value of birthDay =" + birthDay);
System.out.println("The value of birthMonth =" + birthMonth);
System.out.println("The value of studentID =" + studentID);
}
Any body know why?
Also... what does the percentage sign mean in birthDay = 1 + (birthDay % birthMonth); <--- that line of code?
Many thanks guys
I have to copy the following code into a compiler (we use JCreator with the JDK 1.6).. and see what the program does.. however when I do this, i am getting "class, interface, or enum expected" errors on lines 1, 6, 7, 9, 10-13, 15-18. Heres the code....
public static void main(String[] args) {
// Declarations
// Note: If the last 4 digits of your ID begin with 0's
// then drop those. For example: 0035 would become just 35
double birthDay = 20;
double birthMonth = 4;
double studentID = 5246;
//Calculations
birthDay = birthDay * birthMonth * 100
studentID = studentID / birthMonth;
birthDay = 1 + (birthDay % birthMonth);
studentID = studentID - birthDay + (birthMonth * 7);
studentID = studentID + (birthDay * birthMonth);
//Display Results
System.out.println("The value of birthDay =" + birthDay);
System.out.println("The value of birthMonth =" + birthMonth);
System.out.println("The value of studentID =" + studentID);
}
Any body know why?
Also... what does the percentage sign mean in birthDay = 1 + (birthDay % birthMonth); <--- that line of code?
Many thanks guys