-
[SOLVED] Help =] .
hey everyone. im new to the forum. ok im a total noob wen it comes to this. im majoring in computer science and i was doing some class work today and i came across this
--------------------------------------------------------------------------
import java.util.Scanner; //Needed for the scanner class
/**
*this program demonstrates a user controlled loop
*/
public class TestAverage1
{
public static void main(String[] args);
{
int score1, score2, score3; // three test scores
double average; // Average test score
char repeat; // To hold 'y' or 'n'
String input; // To hold input
System.out.println("this program calculates the " +
"average of three test scores.");
// Creat a scanner object for keyboard input.
Scanner keyboard = new Scanner (System.in);
// Get as many sets of tet scores as the user wants.
do
{
// Get the first test score in this set.
System.out.print("Enter score #1:");
score1 = keyboard.nextInt();
// Get the second test score in this set.
System.out.print("Enter score #2:");
score2 = keyboard.nextInt();
// Get the Third test score in this set.
System.out.print("Enter score #3:");
score3 = keyboard.nextInt();
// consume the remaining newline.
keyboard.nextLine();
// Calculate and print the average test score.
average = (score1 + score2 + score3) / 3.0;
System.out.println("The average is" + average);
System.out.println(); //Prints a blank line
//Does the user want to average another set?
System.out.println("would you like to average" + "another set of test scores?");
input = keyboard.nextLine(); // Read a line.
repeat = input.charAt (0); // Get the first char.
} while (repeat == 'Y' || repeat == 'Y');
}
}
--------------------------------------------------------------------------
i tryed to compile it and i get 1 error. the little arrow points to the "m" in "main" at the begining of the code. i tryed posting a link but you cant until u have more than 20 post's
anyways . i asked my prof. about it and he wasnt sure wat it is either. he thinks its because the jdk is old and the computers need to b updated. he told me to see if i can figure out the problem. im not asking for you guys to do it for me. im asking anyone if theres any suggestion to what can it be or if someone has the answer they can give it to me too instead of torturing me lol =]
thanks in advance
-
Error please...
Please post the error message you get when compiling
-
delete "dot-comma" at the end of declaring the main method:
Code:
public static void main(String[] args){
-
@serjant:
All you guys that speak our language so well put a lot of us to shame that only know English.
So don't take it badly if I call the "dot-comma" a semi-colon.
Is that a literal translation or ???
-
Good to know about semicolon, knowing four languages (Hebrew,German,English,Russian) is not very easy stuff,so i think i mixed something with thetranslation. Thanks for correcting me.
-
Thanks serjant. it was the semi-colon that was messing the program up. now the program works perfectly fine. once again thanks =]
-
So, please mark the thread as solved.