1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
valina [46]
3 years ago
6

Write a program that prompts the user to enter time in 12-hour notation. The program then outputs the time in 24-hour notation.

Your program should contain three exception classes: InvalidHr, InvalidMin, and InvalidSec. If user enters invalid value for hour, then the program should throw and catch an InvalidHr object. Same applies to the invalid value for minutes and seconds.
Engineering
1 answer:
Juliette [100K]3 years ago
4 0

Answer:

THE CODE FOR THE PROGRAM IS GIVEN BELOW:

#include <iostream>

#include "ConvertTimeHeader.h"

using namespace std;

int main()

{

convertTime convert;

int hr, mn, sc = 0;

 

cout << "Please input hours in 12 hr notation: ";

cin >> hr;

cout << "Please input minutes: ";

cin >> mn;

cout << "Please input seconds: ";

cin >> sc;

 

convert.invalidHr(hr);

convert.invalidMin(mn);

convert.invalidSec(sc);

convert.printMilTime();

 

system("Pause");

 

return 0;  

 

}

#include <iostream>

#include "ConvertTimeHeader.h"

using namespace std;

int convertTime::invalidHr (int hour)

{

try{

 if (hour < 13 && hour > 0)

  {hour = hour + 12;

  return hour;}

 else{

 

  cin.clear();

  cin.ignore();

  cout << "Invalid input! Please input hour again in correct 12 hour format: ";

  cin >> hour;

  invalidHr(hour);

  throw 10;

 }

   

}

catch (int c) { cout << "Invalid hour input!";}

}

int convertTime::invalidMin (int min)

{

try{

 if (min < 60 && min > 0)

  {return min;}

 else{

 

  cin.clear();

  cin.ignore();

  cout << "Invalid input! Please input minutes again in correct 12 hour format: ";

  cin >> min;

  invalidMin(min);

  throw 20;

  return 0;

 }

   

}

catch (int e) { cout << "Invalid minute input!" << endl;}

}

int convertTime::invalidSec(int sec)

{

try{

 if (sec < 60 && sec > 0)

  {return sec;}

 else{

 

  cin.clear();

  cin.ignore();

  cout << "Invalid input! Please input seconds again in correct 12 hour format: ";

  cin >> sec;

  invalidSec(sec);

  throw 30;

  return 0;

 }

   

}

catch (int t) { cout << "Invalid second input!" << endl;}

}

void convertTime::printMilTime()

{

cout << "Your time converted: " << hour << ":" << min << ":" << sec;

}

Explanation:

You might be interested in
Which of these items is least likely to cause an exhaust emission test failure as of a result of excessive nox emissions? a) poo
Iteru [2.4K]

The item that is least likely to cause an exhaust emission test failure as of a result of excessive nox emissions is; poorflow through the egr system.

<h3 /><h3>What is an exhaust emission?</h3>

Exhaust emissions simply means substances emitted into the atmosphere from the exhaust discharge nozzle of an aircraft or aircraft engine.

Now, when the test fails as a result  of excessive nox emissions, we can say that high NOx emissions can occur when an engine's air-fuel mixture is too lean. Thus, we can conclude that the reason for exhaust emission test failure as of a result of excessive nox emissions is due to poorflow through the egr system.

Read more about emissions at; brainly.com/question/14154063

7 0
3 years ago
Who invented engineering first?​
astra-53 [7]

Explanation:

The earliest civil engineer known by name is Imhotep. As one of the officials of the Pharaoh, Djosèr, he probably designed and supervised the construction of the Pyramid of Djoser (the Step Pyramid) at Saqqara in Egypt around 2630–2611 BC.

8 0
3 years ago
What is the composition of the two phases that form when a stream of 40% A, 39% B, and 21% C separates into two phases? Label th
irga5000 [103]

Answer:

vapor fraction = 0.4 and 0.08

Explanation:

At reasonably high temperatures, a mixture will exist in the form of a sub cooled liquid. Between these extremes, the mixture exists in a two phrase region where it is a vapor liquid equilibrium. From a vapor-liquid phase diagram, a mixture of 40% A, 39% B, and 21% C separates to give the vapor compositions of 0.4 and 0.08.

8 0
3 years ago
Consider a unidirectional continuous fiber-reinforced composite with epoxy as the matrix with 55% by volume fiber.i. Calculate t
ohaa [14]

Answer:

I)E= 40.95 GPa

II)E=5.29 GPa

Explanation:

I)

Given that

E₁ = 2.41 GPa  ,V₁=1-0.55 = 0.45

E₂ = 72.5 GPa   ,V₂=0.55

Longitudinal moduli  given as ;

E= E₁V₁+E₂V₂

E= 2.41 x 0.45 + 72.5 x 0.55 GPa

E= 40.95 GPa

II)

E₁ = 2.41 GPa  ,V₁=1-0.55 = 0.45

E₂ =230 GPa   ,V₂=0.55

Transverse moduli given as:

\dfrac{1}{E}=\dfrac{V_1}{E_1}+\dfrac{V_2}{E_2}

\dfrac{1}{E}=\dfrac{0.45}{2.41}+\dfrac{0.55}{230}

E=5.29 GPa

7 0
3 years ago
When using an alternative method of sizing with two vent connectors for draft hood-equipped water heaters, the effective area of
amid [387]

Answer:

Fifty (50) percent.<em> [50%] </em>

Explanation:

Water heater is a home appliance that comprises of an electric or gas heating unit as well as a water-tank where water is heated and stored for use.

When using an alternative method of sizing with two vent connectors for draft hood-equipped water heaters, the effective area of the common vent connector or vent manifold and all junction fittings shall not be less than the area of the larger vent connector plus fifty (50) percent of the areas of smaller flue collar outlets.

A water heater is primarily vented with an approved and standardized plastic or metallic pipe such as flue or chimney, which allows gas to flow out of the water heater into the surrounding environment.

For a draft hood-equipped water heater, both the water heater and the barometric draft regulators must be installed in the same room. Also, the technician should ensure that the vent is through a concealed space such as conduit and should be labeled as Type L or Type B.

The minimum capacity of a water heater should be calculated based on the number of bathrooms, bedrooms and its first hour rating.

8 0
3 years ago
Other questions:
  • Block B starts from rest and moves downward with a constant acceleration. Knowing that after slider block A has moved 400 mm its
    13·1 answer
  • (Metric) Given the front and right views, create an AutoCAD isometric of the object. Save the drawing as lab5c.dwg. Grid size is
    8·1 answer
  • A combinational switching circuit has four inputs (A, B, C, D) and one output (F).
    9·1 answer
  • Design a column base plate for a W10 3 33 column supporting a service dead load of 20 kips and a service live load of 50 kips. T
    10·1 answer
  • 49. A solenoid coil with a resistance of 30 ohms and an inductance of 200 milli-henrys, is connected to a 230VAC, 50Hz supply. D
    8·1 answer
  • Charles, Clarissa, and Francine all work in Manufacturing. The table shows the breakdown of one day for each employee.
    5·2 answers
  • The component has an exponentially distributed reliability with a mean of 2000 hours what is the probability that it will fail a
    8·1 answer
  • (2pts) In _______________, the pulse amplitude is made proportional to the amplitude of the modulating signal. pulse-amplitude m
    7·1 answer
  • What are the three major costs of owning a vehicle throughout a year?
    12·2 answers
  • A bridge a mass of 800 kg and is able to support up to 4 560 kg. What is its structural efficiency?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!