Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives: Solve problem, design solution and implement using C++ Learn how to use basic C++ constructs and manipulate C++ string class and write functions. Handle

Objectives: Solve problem, design solution and implement using C++ Learn how to use basic C++ constructs and manipulate C++ string class and write functions. Handle different types of input errors

C++

Question1: Write a menu-driven program named "AssignmentRecorder" that will provide following menu to record user's input

assignments: 1. Enter a new assignment 2. Show the largest assignment 3. Show all assignments 4. Exit

- "Enter a new assignment" option will read in one simple assignment in the form: = such as: count = 10 or total = 0 It will format and print out the assignment with proper spacing. You can assume that the user enters the assignment with spaces in between values. - "Show the largest assignment" option will display the largest assignment that has been entered so far - "Show all assignments" option will print out all entered assignments

Requirements: 1. The program must produce the same expected output as provided. 2. Array or vector or list class is not allowed. This is an assignment using string, stream, stringstream and functions. Simple variables and string concatenation will be sufficient to solve this problem. 3. There should be no global variables. Please use only local variables and parameters instead. 4. You must define and use at least 5 functions including main() in your program 5. There must be at least one function using pass-by-reference parameters 6. Scanf and printf are not allowed (Please use C++ cin and cout and C++ formatting) 7. Handle invalid menu options such as negative or too big or even alphanumeric such as "abc" 8. When there is no assignments available, it should display the informational message of "There is no assignment." 9. Please handle the following error conditions: - the user can enter invalid menu number such as 0, 5, or even "abc" - the assignment can have invalid assignment operator such as total * 10 instead of total = 10 - the assignment has the destination of a number instead of a variable name such as 123 = 123 instead of num = 123 - the assignment has the destination of a variable name that starts with a number such as 1count = 123 instead of count = 123 - the assignment value is not a number such as count = abc instead of count = 123 Note: when the error occurs, the error message must be specific and clearly describe the error.

Sample output of a program run:

D:\>AssignmentRecorder

Welcome to assignment recording program.

Assignment Menu:

1. Enter a new assignment

2. Show the largest assignment

3. Show all assignments

4. exit

Enter your option: 0

Invalid selection. Please try again.

Assignment Menu:

1. Enter a new assignment

2. Show the largest assignment

3. Show all assignments

4. exit

Enter your option: 2

The largest assignment:

total = 20

Assignment Menu:

1. Enter a new assignment

2. Show the largest assignment

3. Show all assignments

4. exit

Enter your option: 1

Please enter an assignment:

score = 100

score = 100

Assignment Menu:

1. Enter a new assignment

2. Show the largest assignment

3. Show all assignments

4. exit

Enter your option: 3

All assignments:

count = 10

total = 20

quantity = 5

score = 100

Assignment Menu:

1. Enter a new assignment

2. Show the largest assignment

3. Show all assignments

4. exit

Enter your option: 4

Thank you. Goodbye.

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

Step: 3

blur-text-image

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

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions