classes.....

This is a discussion on classes..... within the C++ Programming forums, part of the General Programming Boards category; This is the code that I have... Code: #include <iostream> #include <fstream> using namespace std; string name; float grade; float ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    16

    Question classes.....

    This is the code that I have...

    Code:
    #include <iostream>
    #include <fstream> 
    
    using namespace std;
    
    
    string name;
    float grade;
    float average;
    string coursename;
    string instrctorname;                                                             
    string coursebook;
    int numstudents;
    
    
    class Student
    { public : void name ();
    		   void grade (float grade);
    		   void average (float average);
    
    
    private : string name;
    	      float grade;
    		  float average;
    
    };
    
    
    class Course
    {public : void coursename ();
    	      void instructorname ();
    		  void coursebook ();
    		  void numstudents ();
    private : string coursename;
    		  string instructorname;
    		  string coursebook;
    		  int numstudents;
    
    };
    This is what the program is supposed to do....

    " Simple Class Design:
    Create a class that represents some typical COURSE and a class that represents STUDENTS.

    A "Student" will contain
    NAME
    GRADES
    AVERAGE

    A "Course" will contain
    COURSE NAME
    COURSE INSTRUCTOR
    COURSE BOOK
    STUDENTS (30)

    There should be methods in the student class to:
    input their grades (from a file)
    calc average
    print their grades and average

    There should be methods in the course class to:
    print all of the students names in the class
    print all the averages for the students in the class






    Am I even heading in the right direction? This program is really starting to frustrate me....any help? please and thanks

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    85
    what format are the grades in from the file?
    Is this all the specs tells you?
    All you have to do now is implement the functions in the class

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    16
    yea how do i do that? that is all i was told to do.
    example of the format
    "StudentName 45 76 23 89 90 100"

    does that answer what u were trying to say?

  4. #4
    Registered User
    Join Date
    Oct 2005
    Posts
    16
    do u have an AOL screen name to talk about this? that may make it easier or MSN?

  5. #5
    Registered User
    Join Date
    Oct 2005
    Posts
    16
    Can Anyone Help Me.......??????? Please

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    >> Am I even heading in the right direction?
    Yes, you are heading in the right direction. Still a long way to go. One at a time declare the functions specified by the assignment. Also, think again about what data needs to be held. For example, the input will look like "StudentName 45 76 23 89 90 100" for a single student, so you need to hold more than one grade for each student.

    You'll need some way to hold multiple students per course. That usually involves a vector, list or array of some sort.

    Start with implementing one thing at a time, then compile it and test it and make sure it is working before continuing on. That way you'll have a specific question to ask when you run into specific trouble.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you Initialize all classes once with New?
    By peacerosetx in forum C++ Programming
    Replies: 12
    Last Post: 07-02-2008, 10:47 AM
  2. Multiple Inheritance - Size of Classes?
    By Zeusbwr in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2004, 08:04 AM
  3. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-23-2004, 11:22 PM
  4. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21