C++   How to Program (Early Objects Version)
C++ How to Program (Early Objects Version)
10th Edition
ISBN: 9780134448824
Author: Paul Deitel; Harvey M. Deitel
Publisher: Pearson Education (US)
Question
Book Icon
Chapter 17, Problem 17.30E
Program Plan Intro

Program Plan:

  • Include header files required
  • Declare and define a function test().
  • Start a try block.
    • Accept a choice to enter a number or a character.
    • If 1 is entered as choice, a number is accepted and checked if it’s a negative number.
    • If a negative number then and throw an exception with integer parameter, which is caught from main function.
    • If 2 is entered as choice, a character is accepted and checked if it is zero. If Zero, then throw an exception with character parameter, which is caught from inside function.
    • Write a catch block with character parameter which will display exception with character.
    • End of function.
  • Start a main function
    • Start a try block which will call a function "test()", that will throw an exception.
    • Write a catch block with integer parameter which will display exception called.
  • Return and exit main.

Blurred answer
Students have asked these similar questions
Benefits of using arrays as instance variables: What are the advantages of incorporating arrays as instance variables within a class? Initializing and managing arrays: How do you initialize and manage arrays within class constructors and mutators (setters)? Example of using arrays as instance variables: Share an example where you have used arrays as instance variables and discuss its application in a real-world scenario. Common mistakes with arrays as instance variables: What are some common mistakes to avoid when working with arrays as instance variables? Information hiding violations: What is the potential violation of information hiding when using arrays as instance variables? How can this be resolved?
Do you think that computers should replace teachers? Give three references with your answer.
Is online learning or face to face learning better to teach students around the around the world? Give reasons for your answer and provide two references with your response. What are benefits of both online learning and face to face learning ? Give two references with your answer. How does online learning and face to face learning affects students around the world? Give two references with your answer.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,