//------------------------------------------------------------------------------
ID: 640876 • Letter: #
Question
//--------------------------------------------------------------------------------------
class Course{
private:
string course_name;
string* students; // Dynamic array to store student names
int number_enrolled;
int capacity;
public:
Course();
Course(const string name, int cap, int enrollment );
Course(const Course &courseObj);
~Course();
friend bool operator == (const Course& course1, const Course& course2);
Course& operator=(const Course& rtSide);
friend ostream& operator << (ostream& outputStream, const Course& courseObj);
string getCourseName() { return course_name};
int getNumberEnrolled() { return number_enrolled};
int getCapacity() { return capacity};
};
//--------------------------------------------------------------------------------------
Course::Course(){
//Set name to unknown and enrollment and capacity to zero
}
//--------------------------------------------------------------------------------------
Course::Course(const string name, int cap, int enrollment){
}
//--------------------------------------------------------------------------------------
Course::Course(const Course &courseObj) {
}
//--------------------------------------------------------------------------------------
bool operator == (const Course& course1, const Course& course2) {
// TRUE if course name, student names, and capacity matches
}
//--------------------------------------------------------------------------------------
Course& Course::operator = (const Course& rtSide) {
}
//--------------------------------------------------------------------------------------
ostream& operator << (ostream& outputStream, const Course& courseObj) {
// Outputs course name with percentage of class full in paranthesis
}
//--------------------------------------------------------------------------------------
Course :: ~Course() {
}
Explanation / Answer
import java.io.*;
class Student {
int rollno;
String name;
int number_of_subjects;
int mark[];
Student(int roll, String stud_name, int noofsub) throws IOException {
rollno = roll;
name = stud_name;
number_of_subjects = noofsub;
getMarks(noofsub);
}
public void getMarks(int nosub) throws IOException {
mark = new int[nosub];
BufferedReader br = new BufferedReader(new InputStreamReader(System. in ));
for (int i = 0; i < nosub; i++) {
System.out.println(
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.