Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
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
For this assignment you will be working with arrays and File I/O. Open a new Java file called Nums.java Prompt a user to enter the name of a text file containing a series of numbers. Important Note: the user should be able to type the name any file that is contained inside their own personal Assignment 18 Java project in Eclipse. Open the file for reading. The first line of the text file will contain the number of numbers in the file. Declare an array of the length specified on this first line of the text file. The subsequent line in the text file will contain a sequence of double numbers - the exact number indicated in the first line of the file. Read this sequence of numbers into the array using a for loop. Using the same, or a second, for loop, sum the numbers and report their sum to the user. Also, multiply the numbers together and report their product to the user. Then, print this information in a text file named results.txt. The sum and the product should be printed to one…
In Java please.   Add comments too!   thank you!
In this project you will generate a poker hand containing five cards randomly selected from a deck of cards. The names of the cards are stored in a text string will be converted into an array. The array will be randomly sorted to "shuffle" the deck.  Each time the user clicks a Deal button, the last five cards of the array will be removed, reducing the size of the deck size. When the size of the deck drops to zero, a new randomly sorted deck will be generated. A preview of the completed project with a randomly generated hand is shown in Figure 7-50.
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