Teachers.Net
JoinLog in
Teachers.Net

Program in c++

By james t owens

  • Advanced
Activity Time
one day
Materials
to write out the program for me
Concepts / Topics
Classes, get andset functions names, majors, and number of credit they are taking this semester

Students write and run a C++ program using a student class, an array of three student objects, input and output loops, and a check for credit totals of 20 or more.

Assignment

Make a list of students for advisors. List each student's name, major, and number of credits they are taking this semester. If any student has registered for 20 or more credits, note that at the bottom of the list.

Student Class Header File

  1. Create a class header file for a student. Include data members for the student's name, major, and number of credits for this semester. None of these data members should be accessible outside the class.
  2. Include get and set member functions for each of the three data members.
  3. Include a member function that prints all the data members, setting widths for three columns of data. Align the name and major on the left and the number of credits on the right. See the sample output below.
  4. Document the header file with a paragraph describing it and documentation throughout describing the functions and lines of code.

Program File

  1. Create a program file that declares an array of student objects. Define the array size as a constant variable and set it to 3 for this exercise.
  2. Use a loop to input the name, major, and number of credits for each student. Use the set member functions to fill the data members of that student.
  3. Print the heading “student list.” Then use another for loop to call each object's print function. See the sample output below.
  4. Use another for loop to get the number of credits for each student object. If the number is 20 or more, print a note a few lines below the list giving that student's name, major, and number of credits.
  5. Document the program file with a paragraph describing it and documentation throughout describing the lines of code.

Sample Runs and Submission

  1. Use the following sample data as a guide. First, run your program with the sample data. Use your name, major, and number of credits for the first student. Then run the program again with your own set of sample data.
  2. Print your source code program file, header file, and typescript file containing your two sample runs.

Sample Output

student list
your name MAJ 6
jehanne D'Arc FRA 20
bill wohlleber CIS 9

Teachers.Net · https://teachers.net/lessons/2448.html