[SOLVED] CS_1C Homework 13-Exceptions

35.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (2 votes)

using HW12

  1. Test the assert macro (both pass and fail); print a corresponding output statement.
  2. Add exceptions to the queue template.
    1. Throw an exception if the capacity is exceeded. Print an appropriate error message in the associated exception handler.
    2. Throw an exception if your program tries to remove from an empty queue. Print an appropriate error message in the associated exception handler.
    3. Test both exceptions

 

Following an exception, the program should allow one to recover from a mistake without corrupting the contents of the queue.

 

Use the command script to capture your interaction compiling and running the program, including all operations, as shown below:

 

CS1C Fall 2018 TTH HW13 50pts Due: Fri 11/16/2018

 

cs1c@cs1c-VirtualBox ~/cs1c/hw/13 $ script hw13.scr Script started, file is hw13.scr cs1c@cs1c-VirtualBox ~/cs1c/hw/13 $ date

…

cs1c@cs1c-VirtualBox ~/cs1c/hw/13 $ ls -l

…

cs1c@cs1c-VirtualBox ~/cs1c/hw/13 $ make all

…

cs1c@cs1c-VirtualBox ~/cs1c/hw/13 $ ls -l

…

cs1c@cs1c-VirtualBox ~/cs1c/hw/13 $ ./hw13

 

HW13 – Exceptions [50 pts]

… // print output from steps 1 and 2 above

 

cs1c@cs1c-VirtualBox ~/cs1c/hw/13 $ exit Script done, file is hw13.scr

cs1c@cs1c-VirtualBox ~/cs1c/hw/13 $ make tar

…

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.