Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help fix my C++ code below, it does not compile. Please fix the necessary so that it would produce the functioning output below. //my

Please help fix my C++ code below, it does not compile. Please fix the necessary so that it would produce the functioning output below.

//my code

#include #ifndef Course.h #define Course.h

class Course { private: std::string stdID; int units; char grade;

public: Course(); Course(std::string stdID, int units, char grade); void set_Units(int units); void set_Grade(char grade); std::string getID() const; int get_Units() const; char get_Grade() const; int get_GP() const; }; #endif

//course.cpp:

#include #include "Course.h"

Course::Course(): stdID(""), units(0), grade(' ') {}

Course::Course(std::string stdID, int units, char grade) : stdID(stdID), units(units), grade(grade) { grade = toupper(grade); } void Course:: set_Units(int units){ units = units; }

void Course:: set_Grade(char grade){ grade = toupper(grade); } std::string Course:: getID() const{ return stdID; }

int Course:: get_Units() const{ return units; }

char Course:: get_Grade() const{ return grade; } int Course:: get_GP() const{ if(grade == 'A') return units * 4; else if(grade == 'B') return units * 3; else if(grade == 'C') return units * 2; else if(grade == 'D') return units; return 0; }

//student.h:

#include #include "Course.h" #ifndef STUDENT_H #define STUDENT_H

class Student { private: std::string stdName; int studentID; std::vector courses; static int NextID;

public: Student(); Student(std::string stdName); void set_Name(std::string stdName); std::string get_Name() const; int get_StudentID() const; void add_Courses(std::string stdID, int units, char grade); bool has_Courses() const; double get_GPA() const; void print_Transcript() const; }; #endif

//student.cpp:

#include #include #include "student.h"

using namespace std; int Student::NextID = 1001;

Student::Student() : stdName("none"), studentID(NextID) { NextID++; }

Student::Student(std::string stdName) : stdName(stdName), studentID(NextID) { NextID++; }

void Student:: set_Name(std::string stdName){ stdName = stdName; } std::string Student:: get_Name() const{ return stdName; }

int Student:: get_StudentID() const{ return studentID; }

void Student:: add_Courses(std::string stdID, int units, char grade){ courses.push_back(Course(stdID, units, grade)); }

bool Student:: has_Courses() const{ return courses.size() > 0; }

double Student:: get_GPA() const{ if(!has_Courses()) return 0;

int total_Grade_Points = 0, total_Credits = 0;

for(Course c: courses){

total_Grade_Points += c.get_GP(); total_Credits += c.get_Units(); } return (double)total_Grade_Points/total_Credits; }

void Student:: print_Transcript() const{

if(!has_Courses()) cout

cout

//main.cpp:

#include #include #include "student.h" #include "course.h"

using namespace std;

int find_Std(vector students, int stdID); int main() { int choice; vector students; string stdName, courseID; int units, stdID, index; char grade; do {

cout > choice; if(choice == 1) { cout

students.push_back(Student(stdName)); cout > stdID;

index = find_Std(students, stdID);

if(index == -1) cout > choice;

if(choice == 1) { cout > courseID; cout > units; cout > grade;

students[index].add_Courses(courseID, units, grade); cout

cout

cout

return 0; }

int find_Std(vector students, int stdID){

for(size_t i=0;i

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Sample application demonstration: Main Menu Choice 1: Add New Event Note: What is red in the sereenshot below is what the user wrote and then hit the Euter key. I used a different color for you so you can distinguish between user input and application output. You don't need to use the colors in your application. Adding New Event Month : 11 Day : 7 Year : 2022 Hour : 17 Minute : 20 Details : CSC 211 end of lecture 05 and start of lecture 66. New event added (Event* 202211071720 ). Press Enter key to return to the menu. Adding New Event Month : 11 Day : 7 Year : 2022 Hour : 8 Minute : Details : Early advisement and registration begin for Spring 2023. New event added (Event 20221107e8ee). Press Enter key to return to the nenu. Choice 2: View Daily Events View Daily Events Month : 11 Day : 7 Year : 2022 Event(s) of Monday, November 7, 2022 : 08:00 (Event\# 202211070800): Early advisenent and registration begin for Spring 2023. 17:20 (Event\# 202211071720): CSC 211 end of lecture 05 and start of lecture 06. Press Enter key to return to the menu. View Monthly Events Note: Events should also be sorted chronologically. Update Event Choice 5: Delete Event Delete Event Enter Event Number : 202210271845 Current Event Details: Thursday, 0ctober 27,2022 at 18:45 In-person open house at BMCC main campus. Are you sure you want to delete this event? (Y/N) Y Event deleted. Press Enter key to return to the menu. Adding New Event Month : 2 Day : 29 Year : 2023 Error: Invalid date. Press Enter key to return to the menu. Bonus Tasks: To get extra credits for your project (Optional), add these new features to your application. Choice 6: Display Monthly Calendar Display Monthly Calendar Choice 7: Display Holidays Display Holidays Enter the year : 2021 Friday, January 1 - New Year's Day Monday, January 18 - Martin Luther King, Jr. Day Monday, February 15 - President's Day Monday, May 31 - Memorial Day Sunday, July 4 - Independence Day Monday, September 6 - Labor Day Monday, 0ctober 11 - Columbus Day Thursday, November 11 - Veterans Day Thursday, November 25 - Thanksgiving Day Saturday, December 25 - Christmas Day Press Enter key to return to the menu. Note: The list of US federal holidays is provided in the next page

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

Are managers the only users of financial reports? Discuss.

Answered: 1 week ago

Question

1. Identify an organization to analyze, preferably your employer.

Answered: 1 week ago

Question

' How many different strategies did you find?

Answered: 1 week ago