Question

3. Suppose the University has two types of academics: students and lecturers. Both of these have names and ids, but studentsti (a) Write the header for a class called Academic and update the Student and Lecturer class headers so that they inherit Ac

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer to Part b is commented in class Student and Lecturer

==================================================================

a)

#ifndef ACADEMIC_H
#define ACADEMIC_H


class Academic
{
public:
string getName();
string getID();
Academic(string name, string id){
this->name=name;
this->id=id;
}
protected:
string name;
string id;
};

#endif // ACADEMIC_H
=================================================================================

#ifndef STUDENT_H
#define STUDENT_H

#include <Academic.h>


class Student : private Academic
{
public:

// Part B
Student(string name, string id){
Student():Academic(name,id);
}
void attendLecture();

};

#endif // STUDENT_H


======================================================================================

#ifndef LECTURER_H
#define LECTURER_H

#include <Academic.h>


class Lecturer : private Academic
{
public:

// Part b
Lecturer(string name, string id){
Student():Academic(name,id);
}
void giveLecture();

protected:

private:
};

#endif // LECTURER_H

Add a comment
Know the answer?
Add Answer to:
3. Suppose the University has two types of academics: students and lecturers. Both of these have...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 3. Suppose the University has two types of academics: students and lecturers. Both of these have...

    3. Suppose the University has two types of academics: students and lecturers. Both of these have names and ids, but students attend lectures while lecturers give them. class Student private: string name; string id; public: Student (string name, string id); string getName ); string getIDO; void attendLecture(); class Lecturer private: string name; string id; public: Lecturer(string name, string id); string getName; string getIDO; void giveLecture (); a) Write the header for a class called Academic and update the Student and...

  • PLEASE DO IN JAVA 3) Add the following method to College: 1. sort(): moves all students...

    PLEASE DO IN JAVA 3) Add the following method to College: 1. sort(): moves all students to the first positions of the array, and all faculties after that. As an example, let fn indicate faculty n and sn indicate student n. If the array contains s1|f1|f2|s2|s3|f3|s4, after invoking sort the array will contain s1|s2|s3|s4|f1|f2|f3 (this does not have to be done “in place”). Students and faculty are sorted by last name. You can use any number of auxiliary (private) methods, if needed....

  • I need help converting the following two classes into one sql table package Practice.model; impor...

    I need help converting the following two classes into one sql table package Practice.model; import java.util.ArrayList; import java.util.List; import Practice.model.Comment; public class Students {          private Integer id;    private String name;    private String specialties;    private String presentation;    List<Comment> comment;       public Students() {}       public Students(Integer id,String name, String specialties, String presentation)    {        this.id= id;        this.name = name;        this.specialties = specialties;        this.presentation = presentation;        this.comment = new ArrayList<Commment>();                  }       public Students(Integer id,String name, String specialties, String presentation, List<Comment> comment)    {        this.id= id;        this.name...

  • I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student...

    I need code in java The Student class: CODE IN JAVA: Student.java file: public class Student {    private String name;    private double gpa;    private int idNumber;    public Student() {        this.name = "";        this.gpa = 0;        this.idNumber = 0;    }    public Student(String name, double gpa, int idNumber) {        this.name = name;        this.gpa = gpa;        this.idNumber = idNumber;    }    public Student(Student s)...

  • 2 Lab5 - Compatibility Mode - Saved to my Mac View Tell me jout References Mailings...

    2 Lab5 - Compatibility Mode - Saved to my Mac View Tell me jout References Mailings Review A Аа C 21 पा daBbCode AaBbCcDc AaBbCcDe AaBb CcD ABCDdF Emphasis Heading 1 Heading 2 Heading Heading ANA- Objectives: In this lab, the following topics will be covered 1. Inheritance in Java), 2. Overriding, and Hiding Inheritance (in Java): Inheritance is an important object-oriented concept that allows classes to be reused in order to define similar, but distinct, classes. In this lab...

  • FOR JAVA: Summary: Create a program that adds students to the class list (see below). The...

    FOR JAVA: Summary: Create a program that adds students to the class list (see below). The solution should be named Roster402_v2.java. Allow the user to control the number of students added to the roster. Ask if the user would like to see their new roster to confirm additions. If yes, then display contents of the file, if no, end the program. ------------------------------------------------------------------------------------- List of student names and IDs for class (this will be your separate text file): Jones, Jim,45 Hicks,...

  • Create an abstract Student class for Parker University. The class contains fields for student ID number,...

    Create an abstract Student class for Parker University. The class contains fields for student ID number, last name, and annual tuition. Include a constructor that requires parameters for the ID number and name. Include get and set methods for each field; the setTuition() method is abstract. Create three Student subclasses named UndergraduateStudent, GraduateStudent, and StudentAtLarge, each with a unique setTuition() method. Tuition for an UndergraduateStudent is $4,000 per semester, tuition for a GraduateStudent is $6,000 per semester, and tuition for...

  • Write a program in Java that prompts a user for Name and id number. and then...

    Write a program in Java that prompts a user for Name and id number. and then the program outputs students GPA MAIN import java.util.StringTokenizer; import javax.swing.JOptionPane; public class Main {    public static void main(String[] args) {                       String thedata = JOptionPane.showInputDialog(null, "Please type in Student Name. ", "Student OOP Program", JOptionPane.INFORMATION_MESSAGE);        String name = thedata;        Student pupil = new Student(name);                   //add code here       ...

  • This is the question about object-oriend programming(java) please show the detail comment and prefect code of...

    This is the question about object-oriend programming(java) please show the detail comment and prefect code of each class, Thank you! This question contain 7 parts(questions) Question 1 Create a class a class Cat with the following UML diagram: (the "-" means private , "+" means public) +-----------------------------------+ | Cat | +-----------------------------------+ | - name: String | | - weight: double | +-----------------------------------+ | + Cat(String name, double weight) | | + getName(): String | | + getWeight(): double | |...

  • A teacher wants to create a list of students in her class. Using the existing Student...

    A teacher wants to create a list of students in her class. Using the existing Student class in this exercise. Create a static ArrayList called classList that adds a student to the classList whenever a new Student is created. In the constructor, you will have to add that Student to the ArrayList. Coding below was given to edit and use public class ClassListTester { public static void main(String[] args) { //You don't need to change anything here, but feel free...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT