# Fee Management Homework Solution in C++

July 05, 2024
Xavier Mitchell
🇺🇸 United States
C++
Prof. Xavier Mitchell, with a master's in computer science from a renowned university in the USA, has completed over 700 orders in C++ assignments. His specialization includes signal-slot mechanism and Model-View-Controller (MVC) architecture in Qt programming. Prof. Mitchell's in-depth knowledge and attention to detail ensure precise and efficient implementation of Qt concepts.
Key Topics
• Fee Management Application in C++
Tip of the day
News

The code in C ++ creates an application to manage courses and fees for a university.

## Fee Management Application in C++

You are attending an online course in C++. The course costs \$500 as the standard fee. Early bird payment gets a 10% discount on the standard fee. Students also have to pay for course materials which cost\$20workbook. There are in total 2workbooksfor the course. Including you, there are a total of 5 students who have enrolled in the course. Write a C++ homework to show the following:

1. The total cost paid by each student. You need to clearly show if the student is benefiting from the early bird discount or not.
2. The total cost paid by all the student.

```/* * assignment1.cpp * */ #include #include using namespace std; #define COST_PER_COURSE 500 #define DISCOUNT 10 #define WORKBOOK_COST 20 #define NUM_WORKBOOKS 2 #define COURSE_NAME "CMP 103" #define TOTAL_STUDENT 5 typedef struct Student { string student_name; // Store the student name bool early_bird; // Store the early bird or not. True that's mean this student have early bird for this course } Student_t; /** * Try to calculate cost for this student. * Return the total cost for this student */ double calculateCost(Student_t stu) { double cost = 0.0; if (stu.early_bird == true) { // If student have early bird. It discount 10% cost += double(COST_PER_COURSE * (100 - DISCOUNT)) / 100; } else { cost += COST_PER_COURSE; } // We have total 2 workbooks for the course cost += NUM_WORKBOOKS * WORKBOOK_COST; return cost; } /** * Print out the screen the student info * * Return the total cost for this student. Using for calculate total cost for this course */ double printStudentInfo(Student_t stu) { cout << "Student Name: " << stu.student_name << endl; cout << "\tIs early bird: " << (stu.early_bird ? "Yes" : "No") << endl; double cost = calculateCost(stu); cout << "\tTotal cost: \$" << cost << endl; return cost; } int main(int argc, char **argv) { // Include you, there are a total of 5 students who have enrolled in the course // We try to identify 5 student Student_t students[TOTAL_STUDENT]; // Simulate data for student list // The first student students[0].student_name = "Johnny Tuot"; students[0].early_bird = true; // The second student students[1].student_name = "David Nguyen"; students[1].early_bird = false; // The third student students[2].student_name = "Nas David"; students[2].early_bird = true; // The four student students[3].student_name = "Andrew"; students[3].early_bird = false; // The five student students[4].student_name = "Kath"; students[4].early_bird = true; double total_cost = 0.0; // Now try to print the student info cout << "The course name: " << COURSE_NAME << endl; cout << "The num of workbooks for course: " << NUM_WORKBOOKS << ". Workbook cost: \$" << WORKBOOK_COST << endl; cout << "Early bird payment discount: " << DISCOUNT << "%" << endl; cout << "Standard Fee: \$" << COST_PER_COURSE << endl; cout << "==================================" << endl; for (int i = 0; i < TOTAL_STUDENT; i++) { total_cost += printStudentInfo(students[i]); } cout << "=================================" << endl; cout << "TOTAL COST PAID BY ALL THE STUDENT: \$" << total_cost << endl; return 0; } ```

Screenshot

Compiler
Running

## Related Samples

ProgrammingHomeworkHelp.com offers comprehensive assignment support for students, featuring a dedicated section with related samples of C++. Whether you're tackling introductory concepts or advanced topics like data structures or algorithms in C++, our samples provide clarity and guidance. Each example is meticulously crafted to showcase best practices, ensuring students grasp coding principles effectively. Trust ProgrammingHomeworkHelp.com for expert assistance and quality resources to excel in your C++ assignments.