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 2 of 2

Thread: Student.java

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    21
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Student.java

    I need to insert a new object and I'm really not sure where to put it.
    the object is: Student myStudent = new Student(StudentName);

    public class Students{


    String studentName;
    double midterm_grade;
    double final_grade;
    double total_grade;
    Students n = new Students();

    public static void main(String args[]){

    String studentName;
    double midterm_grade;
    double final_grade;
    int studentId;

    Scanner input = new Scanner(System.in);


    System.out.println(" ");
    System.out.println(" Welcome to the University Grade Center ");
    System.out.println(" ");

    System.out.println("Enter the Students Name: ");
    studentName = input.nextLine();

    System.out.println(" Enter mid term grade: ");
    midterm_grade = input.nextDouble();

    System.out.println(" Enter final grade: ");
    final_grade = input.nextDouble();
    int number = (int)(Math.random() * 10000000);
    studentId = (int)Math.random() * 10000000;


    }
    int studentId;
    public String getStudentName(){
    return studentName;}
    public void setMidTermGrade(double g){
    midterm_grade = g;}
    public void setFinalGrade(double f){
    final_grade = f;}
    public double getStudentMidTermGrade(){
    return midterm_grade;}
    public double getStudentFinalGrade(){
    return final_grade;}
    public int getStudentId(){
    return studentId;}

    }

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Student.java

    not sure where to put it.
    Where do you need the Student object defined?
    It would be after you get all the data necessary to create it
    and before you need to save it or use it.

Similar Threads

  1. i'm a fresh NIIT java student
    By femoozer in forum Member Introductions
    Replies: 2
    Last Post: August 20th, 2011, 02:12 PM
  2. student CGPA
    By adamu adamu in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 8th, 2011, 06:52 AM
  3. Hello to all!/Java Student.
    By Benjamin Cainan in forum Member Introductions
    Replies: 1
    Last Post: May 3rd, 2011, 09:48 AM
  4. Student Programs
    By Suzanne42 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 26th, 2011, 09:20 AM
  5. Replies: 2
    Last Post: January 7th, 2011, 09:10 PM