Using the example provided in class, create a class declaration for student data
ID: 3885769 • Letter: U
Question
Using the example provided in class, create a class declaration for student data with the following specifications:
The class name should be StudentType.
There should be 5 public members:
- name (first and last together separated by a space)
- classification (freshman = f, sophomore = s, junior = j, senior = sr)
- hometown (city, state)
- id (a 5 digit number)
- show_public_info (will show all public data for a student)
There should be 1 private member:
- gpa (based on a 4.0 scale)
The show_info member is a function but does not need to be implemented.
The member variables do not need default values.
code must be done in c++
Explanation / Answer
//a class declaration for student data
class StudentType {
public:
string name;
char classification;
string hometown;
int id;
void show_public_info() {
//show all public data for a student
}
private:
float gpa;
};
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.