Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
Question
Book Icon
Chapter 16, Problem 7PP
Program Plan Intro

  • Include required library files.
  • Define a class named “ArrOutOfRangeErr”.
  • Declare the required variables, constructors and function inside the access specifier “public” and “private”.
  • Define a “testExcep()” function to test the exception.
    • Using exception, set and get the values.
  • Define a “create2DArr()” function to create an two-dimensional array.
  • Define a “check_args()” function to check the validity and return the message if something is wrong.
  • Define a “set()” function to store values.
  • Define a “get()” function to retrieve the values.
  • Define a default constructor for no messages.
  • Define a parameterized constructor for row and column data.
  • Define a “getMsg()” function to return the exception message string.
  • Define a “getRows()” function to return the number of rows.
  • Define a “getCols()” function to return the number of columns.
  • Define a “getDesiredRow()” function to return the requested row number.
  • Define a “getDesiredColumn()” function to return the requested column number.
  • Define a “writeErr()” function to write the error message.
  • Define a “main()” function.
    • Declare the required variables.
    • Create a 2D array for rows and columns.
    • Populate the rows and columns.
    • Print the array contents using “for” loop.
    • Then test the some boundary cases.

Blurred answer
Students have asked these similar questions
In Java please.   Add comments too!   thank you!
For this part in the assignment, you need to write a program in python that removes allinstances of a target element in a file named inputFile.txt. The user must enter the instance thatyou need to remove from that file. Once you received that instance, you need to check all thecontent in the inputFile.txt and remove that word. The result will be saved in another file calledoutputFile.txt. For example, if you received that the user wants to remove the word “and”, youneed to identify all the matches and remove them in the outputFile.txt document.Requirements: You should create the content in the inputFile.txt, please make them at leastwith ten lines or more. You could include poems, lyrics, news, etc. It is up to you. Also, youmust use functions to solve this part in the assignment
Getting the attached error when inputting the below syntax...help   ORIGINAL QUESTION:  In the Array class of the arrays.py file complete the following: Add preconditions to the methods __getitem__ and __setitem__. The precondition of each method is 0 <= index < size(). Be sure to raise an IndexError exception if the precondition is not satisfied. To test your program run the main() method in the arrays.py file. Your program's output should look like the following: Physical size: 10 Logical size: 0 Items: [None, None, None, None, None, None, None, None, None, None] Traceback (most recent call last): File ".solution/arrays.py", line 69, in <module> main() File ".solution/arrays.py", line 66, in main print(a[0]) File ".solution/arrays.py", line 45, in __getitem__ raise IndexError("Array index out of bounds") IndexError: Array index out of bounds     SYNTAX   Adds a precondition on __getitem__ and __setitem__and raises an exception if it is not satisfied. An Array is a…
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT