Question

In: Computer Science

Week 10 - Please write in C++ as simple as possible RRCC has a schedule of...

Week 10 - Please write in C++ as simple as possible

RRCC has a schedule of courses that includes:

  • Subject (like: CSC)

  • Course Number (like: 119)

  • Section (like: 802)

  • Credits (like: 3)

  • Title

  • Days (like: MW)

  • Time (like 8:00am-9:15am)

  • Instructor

From this schedule information above create a class called RRCC_schedule (with a .cpp file and a .h file). Look at each item above and determine the type of data that will go into the variable. Then create a UML with all the variables and methods (like: the getters and setters, a default constructor, and a constructor that takes all the variables and finally the printValues() ). Once you have the UML then create the three code files for the Schedule.h, the Schedule.cpp file, and the Main file. Then in the main() create three schedule objects with values.

Solutions

Expert Solution

Program Code [C++]

Schedule.h

// RRCC_schedule class

#include <iostream>
using namespace std;

class RRCC_schedule {
  
   private:
      
       // All required data members
      
       string subject;
       int courseNumber;
       int section;
       int credits;
       string title;
       string days;
       string time;
       string instructor;
      
   public:
      
       // Constructors
      
       RRCC_schedule();
       RRCC_schedule(string, int, int, int, string, string, string, string);
      
       // Setters & Getters
      
       void setSubject(string);
       void setCourseNumber(int);
       void setSection(int);
       void setCredits(int);
       void setTitle(string);
       void setDays(string);
       void setTime(string);
       void setInstructor(string);
      
       string getSubject();
       int getCourseNumber();
       int getSection();
       int getCredits();
       string getTitle();
       string getDays();
       string getTime();
       string getInstructor();
      
       void printValues();
};

Schedule.cpp

// Implementation of RRCC_schedule class

#include "Schedule.h"

RRCC_schedule::RRCC_schedule() {
   subject = "";
   courseNumber = 0;
   section = 0;
   credits = 0;
   title = "";
   days = "";
   time = "";
   instructor = "";
}

RRCC_schedule::RRCC_schedule(string sub, int cn, int sec, int cred, string t, string d, string tim, string inst) {
  
   this->subject = sub;
   this->courseNumber = cn;
   this->section = sec;
   this->credits = cred;
   this->title = t;
   this->time = tim;
   this->days = d;
   this->instructor = inst;
}


void RRCC_schedule::setSubject(string sub) {
   this->subject = sub;
}
void RRCC_schedule::setCourseNumber(int cn) {
   this->courseNumber = cn;
}
void RRCC_schedule::setSection(int s) {
   this->section = s;
}
void RRCC_schedule::setTitle(string ti) {
   this->title = ti;
}
void RRCC_schedule::setTime(string t) {
   this->time = t;
}
void RRCC_schedule::setDays(string d) {
   this->days = d;
}
void RRCC_schedule::setInstructor(string inst) {
   this->instructor = inst;
}

string RRCC_schedule::getSubject() {
   return subject;
}
int RRCC_schedule::getCourseNumber() {
   return courseNumber;
}
int RRCC_schedule::getSection() {
   return section;
}
int RRCC_schedule::getCredits() {
   return credits;
}
string RRCC_schedule::getTitle() {
   return title;
}
string RRCC_schedule::getDays() {
   return days;
}
string RRCC_schedule::getTime() {
   return time;
}
string RRCC_schedule::getInstructor() {
   return instructor;
}

void RRCC_schedule::printValues() {
  
   cout << "Subject: " << subject << endl
       << "Course Number: " << courseNumber << endl
       << "Section: " << section << endl
       << "Credits: " << credits << endl
       << "Title: " << title << endl
       << "Days: " << days << endl
       << "Time: " << time << endl
       << "Instructor: " << instructor << endl;
}

main.cpp

#include <iostream>
#include "Schedule.h"

int main() {
  
   // Creating 3 schedule objects
  
   RRCC_schedule s1("CSC", 119, 802, 3, "Computer", "MW", "8:00am-9:15am", "Annie");
   RRCC_schedule s2("CSE", 120, 803, 4, "IT", "TF", "09:30am-11:00am", "John");
   RRCC_schedule s3("SCE", 121, 804, 3, "Business", "MF", "11:15am-12:15am", "Julie");
  
   s1.printValues();
   cout << endl;
   s2.printValues();
   cout << endl;
   s3.printValues();
   cout << endl;
  
   return 0;
}

UML Diagram

Sample Output:-

----------------------------------------------------------------------
COMMENT DOWN FOR ANY QUERIES!!!
HIT A THUMBS UP IF YOU DO LIKE IT!!!


Related Solutions

As simple as possible. Please In C++ Computers are playing an increasing role in education. Write...
As simple as possible. Please In C++ Computers are playing an increasing role in education. Write a program that will help an elementary school student learn multiplication. Use rand() to produce two positive single digit integers. It should then display a question in the following format (assume 6 and 7 are randomly generated): How much is 6 * 7? The student then types the answer. Your program checks the student’s answer. If it is correct, print “Very good!” If the...
Please write in C++ as simple as possible I want you to create a Book Class...
Please write in C++ as simple as possible I want you to create a Book Class for a bookstore. I am not going to tell you what variables should go into it, that is for you to figure out (but you should have at least 5+). And then you must create a UML with all the variables and methods (like: the getters and setters, a default constructor, and a constructor that takes all the variables and finally the printValues() )....
Write in c++ as simple as possible In a right triangle, the square of the length...
Write in c++ as simple as possible In a right triangle, the square of the length on one side is equal to the sum of the squares of the lengths of the other two sides.  Write a program that prompts the user to enter the length of three sides of the tringle (as doubles) and the outputs a message indication whether the triangle is a right triangle.  You should split this into two functions (but only one .cpp file).  One function is main()...
write in C++ as simple as possible please and thanks don't use header file <bits/stdc++.h> All...
write in C++ as simple as possible please and thanks don't use header file <bits/stdc++.h> All programs work with binary numbers which are powers of 2 (2, 4, 8, …).  Write a program that will have a user enter a number (n) less than 10,000. Then have the program put each power of 2 (int) into an array up to and possibly including the number n. This means you don't know at the start how large the array will be, so...
USE C++ and please keep program as simple as possible and also comment so it is...
USE C++ and please keep program as simple as possible and also comment so it is easy to understad Create a structure called time. Its three members, all type int, should be called hours, minutes, and seconds. Write a program that prompts the user to enter a time value in hours, minutes, and seconds. This should be in 12:59:59 format. This entire input should be assigned first to a string variable. Then the string should be tokenized thereby assigning the...
Write the simple shell in C language. Please show some outputs.
Write the simple shell in C language. Please show some outputs.
Please explain how these figures are generated as simple as possible
Source    SS    df    MS    F    p-value A    5.0139    1    5.0139    100.28    0 B    2.1811    2    1.0906    21.81    .0001 AB    0.1344    2    0.0672    1.34    .298 Error    0.6000    12    0.0500        Please explain how these figures are generated as simple as possible
Simple code please thats easy to follow. C++ Write a program that can be used to...
Simple code please thats easy to follow. C++ Write a program that can be used to compare Insertion Sort, Merge Sort and Quick Sort. Program must: Read an array size from the user, dynamically an array of that size, and fill the array with random numbers Sort the array with the Insertion Sort, MergeSort and QuickSort algorithms studied in class, doing a time-stamp on each sort. Use your program to measure and record the time needed to sort random arrays...
C++ program, I'm a beginner so please make sure keep it simple Write a program to...
C++ program, I'm a beginner so please make sure keep it simple Write a program to read the input file, shown below and write out the output file shown below. Use only string objects and string functions to process the data. Do not use c-string functions or stringstream (or istringstream or ostringstream) class objects for your solution. Input File.txt: Cincinnati 27, Buffalo 24 Detroit 31, Cleveland 17 Kansas City 24, Oakland 7 Carolina 35, Minnesota 10 Pittsburgh 19, NY Jets...
Write a simple code for a simple connect the dots game in plain C coding.
Write a simple code for a simple connect the dots game in plain C coding.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT