hi ya! really hope u can help! ive taken on a computer course that is meant to teach me the basics of computing, and while i can understad databases and html, for some reason they have given us object orientated programming and i havent a clue!! ive spend alot of time trying to figure this out and ive no idea! if someone could have a look and point me in the right direction it would be really appreciated. also could u tell me if this is too advanced for a beginners course or if i am just not very good at it lol!

here goes....
A teacher wants a program to help keep track of marks for students a decides on a Student class for his program as follows:

  • each student should have a name, registration number, 3 module codes and 3 module marks
  • the class constructor assigns values, passed as parameters, to the name, registration number and module marks. the module codes are set by a single method setCodes
  • the class has 'access' methods getName that returns the student name, getAverage that returns the average mark of the students 3 marks and getHighMark that returns the highest mark of a student.
  • the class has a set method to update the module marks. the toString method outputs full details of each student including the average mark and highest mark.

Now write an application class UseStudent which

  • declares and creates an instance of Student class. then test each method specified in part a.
  • declare and creates an array called studentArray containing 5 instances of student class. using iteration statements to instantiate with values (name, registration number and 3 marks) input from keyboard. after that, determines how many students obtain an average mark above 60 and prints out the answer

i hope someone can help!!!!

You haven't asked a question. Posting your assignment isn't the same thing. What are you specifically having trouble understanding? What are your thoughts? What have you tried (anything at all)?

I suppose by the time you have been given this assignment your teacher has showed you how to write programs and how to run them or how to declare methods ans use them. I assume that you have some notes on how to declare and instantiate classes, or how to create arrays and loop through them.

* each student should have a name, registration number, 3 module codes and 3 module marks
* the class constructor assigns values, passed as parameters, to the name, registration number and module marks. the module codes are set by a single method setCodes
* the class has 'access' methods getName that returns the student name, getAverage that returns the average mark of the students 3 marks and getHighMark that returns the highest mark of a student.
* the class has a set method to update the module marks. the toString method outputs full details of each student including the average mark and highest mark.

The above tells you exactly what you need for the Student class.

Now that you read the above, we expect to see some work, not excuses.

Also if you search this forum you will find many examples on how read input using the Scanner class

Sorry to give you another smack on the wrists luv but the others are right, you need to show us what you've tried thus far.

The whole point is to learn it, and that's not going to happen if we gave out all the code you need all at once. Object-oriented programming is something you will generally come to encounter in this day and age, even if all you plan on doing is web development (e.g. PHP). That particular problem is extremely simple.

Start your reading here: http://java.sun.com/docs/books/tutorial/java/concepts/. Read up on the concepts of OOP and then look again at your assignment problem with a renewed sense of knowledge :)

Good luck

hi ya! im new to this kind of forum and didnt realise i needed to put up every thing id done already! of course ive done work lol! i was just looking for pointers in the right direction, my lecturer isnt very helpful and hasnt taught us very well :(

ill put up wot ive done in 5, then hopefully someone can help :)

thanks

hi ya! im new to this kind of forum and didnt realise i needed to put up every thing id done already! of course ive done work lol! i was just looking for pointers in the right direction, my lecturer isnt very helpful and hasnt taught us very well :(

ill put up wot ive done in 5, then hopefully someone can help :)

thanks

You didn't ask specific questions, nor you mentioned what you have done. Posting your assignment will give the wring impression to others.

quick start ....... try & u'll do it
:-)

public class Student {
	private String name;
	private int regnum;
	private int grade ;
	public Student (String st_name,int st_regnum ,int st_grade)
	{
		name =st_name ;
		regnum = st_regnum ;
		grade = st_grade ;
		
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	
	public int getRegnum() {
		return regnum;
	}

	public void setRegnum(int regnum) {
		this.regnum = regnum;
	}

	
	
	public int getGrade() {
		return grade;
	}

	public void setGrade(int grade) {
		this.grade = grade;
	}
	
	
	public void Display ()
	{
		 System.out.println( " Name : "+ 
		           getName()+"\nRegistration Number : "+getRegnum()+"\nGrade :"+getGrade());
	}
	
	public double getAverage() //average to 3 student
    {
       int sum = 0; 
    
       for ( int i=0; i<3 ;i++ )   
        sum += grade;           
       return (double) sum / 3;
    } 


}
import java.util.Scanner;

public class StudentTest {

	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in);
		String name ;
		int register ;
		int mark ;
		
	
		System.out.println("Enter name :");
		name =input.nextLine();
		System.out.println("Enter registration  number");
		register =input.nextInt();
		System.out.println("Enter greade :");
		mark =input.nextInt();
		
		 Student students = new Student(name,register,mark);
		
		students.Display();
		students.getAverage();
		
	}

}

quick start ....... try & u'll do it
:-)

Not quite correct when in fact there should be more arguments (3 different grades), and at the average you add the same grade 3 times.

But if your intention was for the OP to figure that out, I am sorry.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.