This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes hello...I need only help....in this question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "hello...I need only help....in this question" Watch "hello...I need only help....in this question" New topic
Author

hello...I need only help....in this question

Ahmed Mohamed
Greenhorn

Joined: Oct 25, 2004
Posts: 8
I have to implement a class that will read marks of every student in different subjects and determine his grade. Grades are based on the average marks.

Given below are the criteria for deciding grades:

Average mark Below 40 Grade = �F�
Between 40 to 54 Grade = �D�
Between 55 to 69 Grade = �C�
Between 70 to 84 Grade = �B�
Above 85 Grade = �A�

Write a well-designed class having default and parameterized constructors to instantiate the class.
Also write different functions to:
1)take user inputs for student name, id and marks for various subjects,
2)get the total number of students entered,
3)number of students falling under every grade, and
4)Generate an annual report for a student in five subjects: Mathematics, Computers, Science, Arts and Games.

* Use Vectors to store every student record


i need only help about the idea of this question......ok..so far i understand that ... here is an outline of my idea :

public class Student
{
string name;
int mark;
int id;

void getInfo()
{}

void getTotalNumber()
{}

}

then i have to start the main function

public static void main (string[] args)
{

// i have to create objects to access the functions
}


please..is this design i correct so far?
i have some doubts about the fucntions point(3) and (4)
also...im confused about the the step of asking the user to input someting.... where do i have to use JOptionpane....inside the main fuction or outside?

thank you very much for help.
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 804
I've seen this problem before! College, first-year Java programming?

You need to move the main method inside your class declaration, or build another driver program (class) that includes the main method. For this type of problem, you may want to use the second way, a separate driver program.

The JOptionPane interaction with the user goes inside the main method.

Good luck! You're off to a good start.


Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Better use "String" not "string",


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 804
Good point. Thanks, Barry.
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
You need to break down the requirements and decide what classes are needed. Next look at the attributes each class should possess and what behaviour they should perform. You have made a good start, but don't forget that each student must be aware of the courses it is taking.
If your using JDK 1.5 you might consider using the new enum mechanism to manage to list of courses.

Have fun doing this project and post whenever you get stuck.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: hello...I need only help....in this question
 
Similar Threads
Java Newbie in need of assistance, reading lines from text file and calculating averages.
? about creating a method
Getting the average to display
Java Object Oriented Grades Program
help in fixing the error