Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Help with this java program

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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


  2. #2
    Junior Member
    Join Date
    Apr 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help with this java program

    this is what i have, but i get an error

    //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
    Last edited by Freaky Chris; April 8th, 2010 at 10:06 AM.

  3. #3

  4. #4
    Junior Member
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help with this java program

    will try now

Similar Threads

  1. How do you add GUI to this java program?
    By leyla in forum AWT / Java Swing
    Replies: 1
    Last Post: October 18th, 2009, 01:32 PM
  2. Basic Java Program Help
    By roaster in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 6th, 2009, 10:28 PM
  3. Convert Java Program to Java ME code
    By rinchan11 in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: October 5th, 2009, 10:18 PM
  4. help with simple java program
    By parvez07 in forum Java Theory & Questions
    Replies: 4
    Last Post: August 25th, 2009, 07:19 AM
  5. Java Program Help
    By javakid93 in forum Java Theory & Questions
    Replies: 6
    Last Post: July 27th, 2009, 11:03 AM