Help with this java program
I was wondering if you guys could help me with this program, as i got absolutely no clue how to do it. I'm a fast learner so if i see how its done i know i'll get it immediately... so if you can help me, that would be great.
"develop a Java application that will determine the average for each of the three students. You are given a list of the students IDs, firtsnames, lastnames and three quizzes. Your program should input the information for each student from the keyboard"
Create a class called Student that includes six pieces of information as instance variables, a student Id. (type int), a firstname (type String), a lastname (type String), quiz1 (type int) quiz2 (type int) and quiz 3 (type int). Your class should have a constructor that initializes six instance variables and assumes that the values provided are correct. Provide a set and a get method for each instance variable. In addition provide a (quiz1+quiz2+quiz3 and average). Write a test application named StudentTest that demonstrates class Student's capabilities
thanks in advanced guys
Re: Help with this java program
this is what i have, but i get an error
Code :
//Quiz
public class Student {
// main method begins execution of Java application
public static void main( String args[] )
{
Student student1 = new Student();
Student student2 = new Student();
Student student3 = new Student();
Scanner input = new Scanner( System.in );
String first;
String last;
int quiz1;
int quiz2;
int quiz3;
System.out.print( "Enter the first name of the first Student: " );
first = input.nextString();
student1.setfirstName( first );
System.out.print( "Enter the last name of the first student: " );
last = input.nextString();
student1.setlastName( last );
System.out.print( "Enter the grade of quiz1 for the first student: " );
quiz1 = input.nextInt();
student1.setfirstGrade( quiz1 );
System.out.print( "Enter the grade of quiz2 for the first student: " );
quiz2 = input.nextInt();
student1.setsecondGrade( quiz2 );
System.out.print( "Enter the grade of quiz3 for the first student: " );
quiz3 = input.nextInt();
student1.setthirdGrade( quiz3 );
System.out.print( "Enter the first name of the second student: " );
first = input.nextString();
student2.setfirstName( first );
System.out.print( "Enter the last name of the second student: " );
last = input.nextString();
student2.setlastName( last );
System.out.print( "Enter the grade of quiz1 for the second student: " );
quiz1 = input.nextInt();
student2.setfirstGrade( quiz1 );
System.out.print( "Enter the grade of quiz2 for the second student: " );
quiz2 = input.nextInt();
student2.setsecondGrade( quiz2 );
System.out.print( "Enter the grade of quiz3 for the second student: " );
quiz3 = input.nextInt();
student2.setthirdGrade( quiz3 );
System.out.print( "Enter the first name of the third student: " );
first = input.nextString();
student3.setfirstName( first );
System.out.print( "Enter the last name of the third student: " );
last = input.nextString();
student3.setlastName( last );
System.out.print( "Enter the grade of quiz1 for the third student: " );
quiz1 = input.nextInt();
student3.setfirstGrade( quiz1 );
System.out.print( "Enter the grade of quiz2 for the third student: " );
quiz2 = input.nextInt();
student3.setsecondGrade( quiz2 );
System.out.print( "Enter the grade of quiz3 for the third student: " );
quiz3 = input.nextInt();
student3.setthirdGrade( quiz3 );
//displays employee's salary and full name.
System.out.printf( "Now displaying students full names and
grades.\n");
System.out.printf( student1.getfirstName()," ", student1.getlastName(),
" ", student1.getfirstGrade()," " student1.getsecondGrade(), " " student1.getthirdGrade()," " (quiz1+quiz+quiz3)/3, "Average: \n" );
System.out.printf( student2.getfirstName()," ", student2.getlastName()," ", student2.getfirstGrade()," " student2.getsecondGrade(), " " student2.getthirdGrade()," " (quiz1+quiz+quiz3)/3, "Average: \n" );
System.out.printf( student3.getfirstName()," ", student3.getlastName()," ", student3.getfirstGrade()," " student3.getsecondGrade(), " " student3.getthirdGrade()," " (quiz1+quiz+quiz3)/3, "Average: \n" );
}
}//end main
Re: Help with this java program