C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
bartleby

Concept explainers

Question
Book Icon
Chapter 14, Problem 4PE
Program Plan Intro

Program Plan:

1. Below mentioned variables are used:

  • input time value entered as input by the user.
  • hr− substring of input and holds the hour value.
  • min- substring of input and holds the Minutes value.
  • sec -substring of input and holds the Seconds value.
  • h−integer variable that holds the value of the hour.
  • m- integer variable that holds the value of minutes.
  • s- integer variable that holds the value of seconds.
  • AorP- integer variable which is 0 when time entered as AM or 1 if it is PM.

2. Below Mentioned functions are used:

  • invalidHr()-the function of class invalidHr which is for throwing invalid hour exception.
  • invalidMin()-the function of class invalidMin which is for throwing invalid minutes exception.
  • invalidSec()-function of class invalidSec which is for throwing invalid seconds exception.
  • main()-main function in the program that reads the input and prints the output.

Program Description:

The program is designed to show the 12 hour format input time in a 24-hour format. The program has three exceptional cases that are for inappropriate hours, minutes, or seconds. Three classes are defined to handle such exceptions.

Blurred answer
Students have asked these similar questions
Information Security Risk and Vulnerability Assessment 1- Which TCP/IP protocol is used to convert the IP address to the Mac address? Explain 2-What popular switch feature allows you to create communication boundaries between systems connected to the switch3- what types of vulnerability directly related to the programmer of the software?4- Who ensures the entity implements appropriate security controls to protect an asset?         Please do not use AI and add refrence
Find the voltage V0 across the 4K resistor using the mesh method or nodal analysis. Note: I have already simulated it and the value it should give is -1.714V
Resolver por superposicion

Chapter 14 Solutions

C++ Programming: From Problem Analysis to Program Design

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
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
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:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT