Question: Solve the following questions by defining a class Student instead. Write a C++ program that will define a class Student based on the information given;
Solve the following questions by defining a class Student instead. Write a C++ program that will define a class Student based on the information given; then solve the question 2) and 3), by creating two objects: student 1 and student2. Use C++ language.
1) Suppose we want to keep the following information for each student in the department:
ID - long integer Phone Number - 3 pieces (area code (integer), prefix (integer), and suffix (integer)) Date of Birth - 3 pieces (month (integer), day (integer), and year (integer) ) Overall GPA - float First Letter of Last name - char First Letter of First Name - char
Assuming we don't know about structures and classes, how do you assign these values to student1? Write the program segment that declares the required variables, then assign the following values to student1:
ID - 444444444 Phone Number (3 pieces) - 828, 888, 8888 Date of Birth (3 pieces) - 11, 21, 1985 Overall GPA - 3.45 First Letter of Last Name: T First Letter of First Name: R
How do you assign the values to student1 and student2 in the same program? Write the program segment that declares the required variables, then assign the values to student1 and student2. Here is the information on student2:
ID - 555555555 Phone Number (3 pieces) - 828, 777, 7777 Date of Birth (3 pieces) - 9, 2, 1965 Overall GPA - 3.05 First Letter of Last Name: S First Letter of First Name: G
As you have noticed, assigning such values to many students without packing all of this information into one variable is a very difficult task.
2) Write the program segment that determines which one of these two students is younger.
3) Write the program segment to determine whether these students have the same area code.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
