Page 1 of 1

Solve problem, design solution and implement using C++ Learn how to use basic C++ constructs and manipulate C++ arrays H

Posted: Mon Jun 06, 2022 5:39 pm
by answerhappygod
Solve problem, design solution and implement using C++
Learn how to use basic C++ constructs and manipulate C++
arrays
Handle different types of input errors
Description:
Write a command-driven program named "searchClasses" that will
search for courses using commands
enroll
detail
search
units>=
help
exit
- "enroll" command will read in the class name and the number of
units
- "detail" command will print out the brief student enrollment
info: name, id, total number of classes, total number of units and
the total fee based on $31.00 per unit and the actual list of
classes
- "search" command will print out the list of courses that contains
the search keyword
- "units>=" command will print out the list of courses that have
greater or equal the given search units
- "help" command will print out the list of valid commands
- "exit" command will exit the program
Requirements:
1. The program must produce the same expected output as
provided.
2. Because this program is using arrays, you can declare these
constants globally
const int MAX_NUM_OF_CLASSES = 5 ;
const double FEE_PER_UNIT = 31.0 ;
3. This assignment is about array and you must use array of string
for class names and array of integers for class units.
int numOfClasses = 0 ;
string classList[MAX_NUM_OF_CLASSES] ;
int unitList[MAX_NUM_OF_CLASSES] ;
These must be declared locally and they are only local
variables.
4. There should be no global variables. Please use only local
variables and parameters instead
5. You must define and use at least 6 functions including main() in
your program and you must show how to pass arrays to the
functions
6. Scanf and printf are not allowed (Please use C++ cin and cout
and C++ formatting)
7. Please format fee with only 2 decimal places after the period.
The list of classes need to be aligned.
8. There is no error checking required in this program
9. When search for name and units, please display "Search did not
match any class." when search found no result.
and you will need to keep track of the actual number of active
classes separately in its own integer variable.
Example of expected output:
E:\>searchClasses
Please enter a command: menu
Invalid command. Please enter "help" for the list of valid
commands.
Please enter a command: help
List of available commands:
enroll - to enroll in a class
detail - to list the enrollment in details
search - to search for a word in the class list
units>= - to search for classes with units greater and
equal
help - to display list of valid commands
exit - to exit the program
Please enter a command: enroll
Please enter the class name: Introduction to C++
Please enter the number of units for this class: 4
You are enrolled.
Please enter a command: detail
======================================
List of classes:
Class: Introduction to C++ Units: 4
Total classes: 1
Total units: 4
Total fee: $124.00
======================================
Please enter a command: enroll
Please enter the class name: Data Structure
Please enter the number of units for this class: 5
You are enrolled.
Please enter a command: enroll
Please enter the class name: C++ Programming
Please enter the number of units for this class: 3
You are enrolled.
Please enter a command: detail
======================================
List of classes:
Class: Introduction to C++ Units: 4
Class: Data Structure Units: 5
Class: C++ Programming Units: 3
Total classes: 3
Total units: 12
Total fee: $372.00
======================================
Please enter a command: search
Please enter the search word: C++
======================================
Class: Introduction to C++ Units: 4
Class: C++ Programming Units: 3
======================================
Please enter a command: search
Please enter the search word: Data
======================================
Class: Data Structure Units: 5
======================================
Please enter a command: search
Please enter the search word: Class
======================================
Search did not match any class.
======================================
Please enter a command: search
Please enter the search word: Units
======================================
Search did not match any class.
======================================
Please enter a command: search
Please enter the search word: Java
======================================
Search did not match any class.
======================================
Please enter a command: units>=
Please enter the search units: 10
======================================
Search did not match any class.
======================================
Please enter a command: units>=
Please enter the search units: 3
======================================
Class: Introduction to C++ Units: 4
Class: Data Structure Units: 5
Class: C++ Programming Units: 3
======================================
Please enter a command: units>=
Please enter the search units: 4
======================================
Class: Introduction to C++ Units: 4
Class: Data Structure Units: 5
======================================
Please enter a command: units>=
Please enter the search units: 5
======================================
Class: Data Structure Units: 5
======================================
Please enter a command: units>=
Please enter the search units: 6
======================================
Search did not match any class.
======================================
Please enter a command: quit
Invalid command. Please enter "help" for the list of valid
commands.
Please enter a command: exit
Thank you.
(please check the given output, the output should be same as
given example.)