help me

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kickioly@gmail.com

    #1

    help me

    Hi everyone, this is my first time here and i hope it will not be the
    last, i have a problem here solving this C++ problem,and i hope that
    someone here to solve it and i'll be happy if you do it for me.



    Write a C++ program that calls the following functions:

    a) READSTUDENTS that reads students' Name, Address, Date of Birth,
    and 4 marks: First test mark (0 - 10), Midterm exam mark (0- 20), Lab
    mark (0-30) and Final exam mark (0-40).

    b) CalculateTotalM ark that calculates, for each student, the total mark
    earned (0 - 100).

    c) FindGrade that finds the relevant character grade for each student.

    d) CalculateAverag e that calculates the Class average.

    e) DisplayBelowAve rage that displays students' name, address and
    date of birth of with total mark below class average.

    Notes:

    1. The total number of students is not known in advance: You should
    find a way to stop reading students' information!!

    2. Store students' information in an array of struct.

    3. Choose appropriate parameters (calling by value / by reference) to
    all the functions needed.

    4. Do not use global variables!!!

  • benben

    #2
    Re: help me

    kickioly@gmail. com wrote:
    Hi everyone, this is my first time here and i hope it will not be the
    last, i have a problem here solving this C++ problem,and i hope that
    someone here to solve it and i'll be happy if you do it for me.
    >
    >
    >
    [C++ homework spec snipped]

    We understand you have C++ project undertaken but you forgot to tell us
    what exactly your problem is.

    Regards,
    Ben

    Comment

    • Ivan Vecerina

      #3
      Re: help me

      <kickioly@gmail .comwrote in message
      news:1163337246 .954023.164040@ h48g2000cwc.goo glegroups.com.. .
      : Hi everyone, this is my first time here and i hope it will not be the
      : last, i have a problem here solving this C++ problem,and i hope that
      : someone here to solve it and i'll be happy if you do it for me.

      Please read this NG's FAQ:


      Give it a try yourself first, then post portions of your code
      and ask for specific advice or help.


      Ivan
      --
      http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form

      Comment

      • Daniel T.

        #4
        Re: help me

        kickioly@gmail. com wrote:
        Write a C++ program that calls the following functions:
        >
        a) READSTUDENTS that reads students' Name, Address, Date of Birth,
        and 4 marks: First test mark (0 - 10), Midterm exam mark (0- 20), Lab
        mark (0-30) and Final exam mark (0-40).
        Let's start small. What do you think the input of the above function
        should be? What should its output be? Answer the same questions for each
        of the functions below as well.
        b) CalculateTotalM ark that calculates, for each student, the total mark
        earned (0 - 100).
        >
        c) FindGrade that finds the relevant character grade for each student.
        >
        d) CalculateAverag e that calculates the Class average.
        >
        e) DisplayBelowAve rage that displays students' name, address and
        date of birth of with total mark below class average.
        >
        Notes:
        >
        1. The total number of students is not known in advance: You should
        find a way to stop reading students' information!!
        >
        2. Store students' information in an array of struct.
        >
        3. Choose appropriate parameters (calling by value / by reference) to
        all the functions needed.
        >
        4. Do not use global variables!!!
        --
        To send me email, put "sheltie" in the subject.

        Comment

        • kickioly@gmail.com

          #5
          Re: help me


          benben wrote:
          kickioly@gmail. com wrote:
          Hi everyone, this is my first time here and i hope it will not be the
          last, i have a problem here solving this C++ problem,and i hope that
          someone here to solve it and i'll be happy if you do it for me.

          [C++ homework spec snipped]
          >
          We understand you have C++ project undertaken but you forgot to tell us
          what exactly your problem is.
          >
          I solved some exercises and i faced this problem and i dont know where
          do i start with it, I must to discuss this problem in the class
          tomorrow, I just hope to anyone solved it note that we have taken
          arrays and structs.

          Comment

          • Salt_Peter

            #6
            Re: help me


            kickioly@gmail. com wrote:
            Hi everyone, this is my first time here and i hope it will not be the
            last, i have a problem here solving this C++ problem,and i hope that
            someone here to solve it and i'll be happy if you do it for me.
            >
            >
            >
            Write a C++ program that calls the following functions:
            >
            a) READSTUDENTS that reads students' Name, Address, Date of Birth,
            and 4 marks: First test mark (0 - 10), Midterm exam mark (0- 20), Lab
            mark (0-30) and Final exam mark (0-40).
            >
            b) CalculateTotalM ark that calculates, for each student, the total mark
            earned (0 - 100).
            >
            c) FindGrade that finds the relevant character grade for each student.
            >
            d) CalculateAverag e that calculates the Class average.
            >
            e) DisplayBelowAve rage that displays students' name, address and
            date of birth of with total mark below class average.
            >
            Notes:
            >
            1. The total number of students is not known in advance: You should
            find a way to stop reading students' information!!
            >
            2. Store students' information in an array of struct.
            >
            3. Choose appropriate parameters (calling by value / by reference) to
            all the functions needed.
            >
            4. Do not use global variables!!!
            You can do it !!
            start with a) and only a). How do you store a student? Forget the
            marks.

            If we do the homework for you:
            1) you'll be twice as confused.
            2) the teacher will know
            3) you will have learned nothing

            Comment

            • osmium

              #7
              Re: help me

              <kickioly@gmail .comwrote:
              Hi everyone, this is my first time here and i hope it will not be the
              last, i have a problem here solving this C++ problem,and i hope that
              someone here to solve it and i'll be happy if you do it for me.
              >
              >
              >
              Write a C++ program that calls the following functions:
              >
              a) READSTUDENTS that reads students' Name, Address, Date of Birth,
              and 4 marks: First test mark (0 - 10), Midterm exam mark (0- 20), Lab
              mark (0-30) and Final exam mark (0-40).
              Use simple names like Sally, John, and so on. You are not taking a typing
              class. Date of birth is likely a struct within a struct. I would make
              those four scores an array within an array - it will make computation of the
              total easier later on. .
              b) CalculateTotalM ark that calculates, for each student, the total mark
              earned (0 - 100).
              >
              c) FindGrade that finds the relevant character grade for each student.
              The instructor may give you some guidelines here for the conversion,
              otherwise make some thresholds up yourself.
              d) CalculateAverag e that calculates the Class average.
              Note that an average is usually a decimal number, not an integer.
              e) DisplayBelowAve rage that displays students' name, address and
              date of birth of with total mark below class average.
              I don't know what that means.
              Notes:
              >
              1. The total number of students is not known in advance: You should
              find a way to stop reading students' information!!
              Look up EOF. The user signals EOF with ctrl d (Unix) or ctrl z (Windows).
              2. Store students' information in an array of struct.
              The array should be owned by main since many of the functions will have to
              share the same data. Guess at an initial size, and double your guess every
              time the current guess is exceeded. An array of your own devising is not a
              really good way to handle this problem, but there is absolutely nothing to
              be gained by being a smart ass. At least in school.
              3. Choose appropriate parameters (calling by value / by reference) to
              all the functions needed.
              >
              4. Do not use global variables!!!
              Start by defining a struct to contain the student data.
              Compile *often*!
              ----
              Can you use C++ style strings? (aka the strings in STL.) My guess is, no,
              you can't.


              Comment

              • Martin Jørgensen

                #8
                Re: help me

                Daniel T. wrote:
                kickioly@gmail. com wrote:
                >
                >
                >>Write a C++ program that calls the following functions:
                >>
                >>a) READSTUDENTS that reads students' Name, Address, Date of Birth,
                >>and 4 marks: First test mark (0 - 10), Midterm exam mark (0- 20), Lab
                >>mark (0-30) and Final exam mark (0-40).
                >
                >
                Let's start small. What do you think the input of the above function
                should be? What should its output be? Answer the same questions for each
                of the functions below as well.
                Agreed. How about making a students class?

                I'll also just contribute a bit:

                class Students
                {
                private:
                string name;
                string address;
                // dob - well, this is an interesting problem...
                int mark1;
                int mark2;
                int mark3;
                int mark4;

                public:
                // constructor etc..
                // read_student( something ... )
                // something that calculates average...
                // etc... functions b/c/d/e/whatever
                }

                Don't know if there are better ways... I still have a lot to learn...

                And ofcourse:

                int main
                {
                // use of students class here...
                }


                Best regards
                Martin Jørgensen

                --
                ---------------------------------------------------------------------------
                Home of Martin Jørgensen - http://www.martinjoergensen.dk

                Comment

                • Daniel T.

                  #9
                  Re: help me

                  Martin Jrgensen <hotmail_spam@h otmail.comwrote :
                  Daniel T. wrote:
                  >kickioly@gmail. com wrote:
                  >>
                  >>
                  >>>Write a C++ program that calls the following functions:
                  >>>
                  >>>a) READSTUDENTS that reads students' Name, Address, Date of Birth,
                  >>>and 4 marks: First test mark (0 - 10), Midterm exam mark (0- 20),
                  >>>Lab mark (0-30) and Final exam mark (0-40).
                  >>
                  >>
                  >Let's start small. What do you think the input of the above
                  >function should be? What should its output be? Answer the same
                  >questions for each of the functions below as well.
                  >
                  Agreed. How about making a students class?
                  It's tough to say. The OP may not be allowed to use class constructs yet
                  (if the teacher hasn't covered the topic for example.)

                  That's one reason I tend not to present solutions to homework
                  assignments. It's highly likely that I will use constructs that the
                  student doesn't yet know about.
                  I'll also just contribute a bit:
                  >
                  class Students
                  {
                  private:
                  string name;
                  string address;
                  // dob - well, this is an interesting problem...
                  int mark1;
                  int mark2;
                  int mark3;
                  int mark4;
                  >
                  public:
                  // constructor etc..
                  // read_student( something ... )
                  // something that calculates average...
                  // etc... functions b/c/d/e/whatever
                  }
                  >
                  Don't know if there are better ways... I still have a lot to learn...
                  Often, homework assignments are over-specified because the teacher is
                  trying to stress a particular solution. In this case the student was
                  specifically asked to produce a particular set of functions. The
                  question is, can they be member-functions?

                  --
                  To send me email, put "sheltie" in the subject.

                  Comment

                  • Jim Langston

                    #10
                    Re: help me

                    <kickioly@gmail .comwrote in message
                    news:1163337246 .954023.164040@ h48g2000cwc.goo glegroups.com.. .
                    Hi everyone, this is my first time here and i hope it will not be the
                    last, i have a problem here solving this C++ problem,and i hope that
                    someone here to solve it and i'll be happy if you do it for me.
                    >
                    >
                    >
                    Write a C++ program that calls the following functions:
                    Note: "functions" Means you'll need to write functions.
                    a) READSTUDENTS that reads students' Name, Address, Date of Birth,
                    and 4 marks: First test mark (0 - 10), Midterm exam mark (0- 20), Lab
                    mark (0-30) and Final exam mark (0-40).
                    Your teacher didn't specify where it was to read them from, the keyboard or
                    a file. For simplicity I would read from they keyboard. Somehow you need
                    to get the data from this function to the main program. Best way would be
                    to return something, most likely a structure. So, design a structure with
                    the information ( name, address, etc...) and return it.

                    StudentInfo READSTUDENTS()
                    {
                    // write code here to read from the keyboard into the StudentInfo structure
                    you designed
                    }
                    b) CalculateTotalM ark that calculates, for each student, the total mark
                    earned (0 - 100).
                    Again, a function. Since you already have a structure with the info, just
                    pass that in and return the total mark.

                    int CalculateTotalM ark( StudentInfo )
                    {
                    // calculate total mark and return it
                    }
                    c) FindGrade that finds the relevant character grade for each student.
                    You could pass in the total mark you calculated in the previous function,
                    and return a character grade, I would return a std::string

                    std::string FindGrade( int TotalMark )
                    {
                    // calculate grade string from total mark and return it
                    }
                    d) CalculateAverag e that calculates the Class average
                    Okay, now you have to pass in all the class's grades. So we'll want to hold
                    those StudentInfo structures in some type of array, I would use a
                    std::vector. Return the average. Note, teacher wants you to use an array
                    of struct instead.

                    int CalculateAverag e( StudentInfo[] Students, int NumOfStudents )
                    {
                    // iterate through the StudentInfo and calculate the class average and
                    return it
                    }
                    e) DisplayBelowAve rage that displays students' name, address and
                    date of birth of with total mark below class average.
                    Hmm.. It looks like we have a need to store this info somewhere, so you
                    should add the fields to the StudentInfo, their grade, average, etc... Keep
                    that in mind when designing the above functions, or modify them now to do
                    that
                    Notes:
                    >
                    1. The total number of students is not known in advance: You should
                    find a way to stop reading students' information!!
                    Since we are using std::cin entering a name of X would work. Or some other
                    method you decide on.
                    2. Store students' information in an array of struct.
                    Array of struct? How can you store them in an array of struct when you
                    don't know how many are to be stored? This is (IMO) a wrong way to approach
                    this, but it's your instructor. Just make sure you have a large enough
                    array. I would go with 1024 or 2048 or something, and make sure you don't
                    try to load more in.
                    3. Choose appropriate parameters (calling by value / by reference) to
                    all the functions needed.
                    Right
                    4. Do not use global variables!!!
                    Right.

                    Go over everything and then start with step 1.

                    This is more help than I normally give for homework, and is all I'll give.


                    Comment

                    • kickioly@gmail.com

                      #11
                      Re: help me


                      Jim Langston wrote:
                      <kickioly@gmail .comwrote in message
                      news:1163337246 .954023.164040@ h48g2000cwc.goo glegroups.com.. .
                      Hi everyone, this is my first time here and i hope it will not be the
                      last, i have a problem here solving this C++ problem,and i hope that
                      someone here to solve it and i'll be happy if you do it for me.



                      Write a C++ program that calls the following functions:
                      >
                      Note: "functions" Means you'll need to write functions.
                      >
                      a) READSTUDENTS that reads students' Name, Address, Date of Birth,
                      and 4 marks: First test mark (0 - 10), Midterm exam mark (0- 20), Lab
                      mark (0-30) and Final exam mark (0-40).
                      >
                      Your teacher didn't specify where it was to read them from, the keyboard or
                      a file. For simplicity I would read from they keyboard. Somehow you need
                      to get the data from this function to the main program. Best way would be
                      to return something, most likely a structure. So, design a structure with
                      the information ( name, address, etc...) and return it.
                      >
                      StudentInfo READSTUDENTS()
                      {
                      // write code here to read from the keyboard into the StudentInfo structure
                      you designed
                      }
                      >
                      b) CalculateTotalM ark that calculates, for each student, the total mark
                      earned (0 - 100).
                      >
                      Again, a function. Since you already have a structure with the info, just
                      pass that in and return the total mark.
                      >
                      int CalculateTotalM ark( StudentInfo )
                      {
                      // calculate total mark and return it
                      }
                      >
                      c) FindGrade that finds the relevant character grade for each student.
                      >
                      You could pass in the total mark you calculated in the previous function,
                      and return a character grade, I would return a std::string
                      >
                      std::string FindGrade( int TotalMark )
                      {
                      // calculate grade string from total mark and return it
                      }
                      >
                      d) CalculateAverag e that calculates the Class average
                      >
                      Okay, now you have to pass in all the class's grades. So we'll want to hold
                      those StudentInfo structures in some type of array, I would use a
                      std::vector. Return the average. Note, teacher wants you to use an array
                      of struct instead.
                      >
                      int CalculateAverag e( StudentInfo[] Students, int NumOfStudents )
                      {
                      // iterate through the StudentInfo and calculate the class average and
                      return it
                      }
                      >
                      e) DisplayBelowAve rage that displays students' name, address and
                      date of birth of with total mark below class average.
                      >
                      Hmm.. It looks like we have a need to store this info somewhere, so you
                      should add the fields to the StudentInfo, their grade, average, etc... Keep
                      that in mind when designing the above functions, or modify them now to do
                      that
                      >
                      Notes:

                      1. The total number of students is not known in advance: You should
                      find a way to stop reading students' information!!
                      >
                      Since we are using std::cin entering a name of X would work. Or some other
                      method you decide on.
                      >
                      2. Store students' information in an array of struct.
                      >
                      Array of struct? How can you store them in an array of struct when you
                      don't know how many are to be stored? This is (IMO) a wrong way to approach
                      this, but it's your instructor. Just make sure you have a large enough
                      array. I would go with 1024 or 2048 or something, and make sure you don't
                      try to load more in.
                      >
                      3. Choose appropriate parameters (calling by value / by reference) to
                      all the functions needed.
                      >
                      Right
                      >
                      4. Do not use global variables!!!
                      >
                      Right.
                      >
                      Go over everything and then start with step 1.
                      >
                      This is more help than I normally give for homework, and is all I'll give.
                      My Hat Off to :
                      benben, Ivan Vecerina, Daniel T, Salt_Peter, osmium, Martin Jørgensen,
                      Jim Langston
                      Thank you

                      I can see alot of things that i didnt notes it befor, and its being
                      clear for me..

                      Comment

                      Working...