answer.
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]
2 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]2 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
Suppose we store a relation R (x,y) in a grid file. Both attributes have a range of values from 0 to 1000. The partitions of thi
leva [86]

Answer:

For (a) The total number of buckets from the given query for the relation is 25 buckets (b) the nearest neighboring query is (80, 200) (80, 150), (100, 150), (120,150) and (120, 200)

Explanation:

From the question stated, we need to define what a Grid file is

Grid File it is a structure of data that are used to divide the total space into a grid non-periodic, where set of point (small) are defined by more than one cells of the grid.

(a)Finding buckets for the query

The relation is divided into two parts which ranges from 0 to 1000, the first part is partitioned in every 20 units, at 20, 40, 60 etc; a second part is partitioned into every 50 units at 50, 100, 150 etc.

The total number of buckets from the given query for the relation is 25 buckets

(b)Finding the closest point or nearest point

The closest point discovered in the distance is little above 15

These points are are the points closer to the point target (110, 205) which can be found in five neighboring rectangles with left corners lower is stated as follows:

(80, 200) (80, 150), (100, 150), (120,150) and (120, 200)

3 0
2 years ago
What properties should the head of a carpenter’s hammer possess? How would you manufacture a hammer head?
BabaBlast [244]

Properties of Carpenter's hammer possess

Explanation:

1.The head of a carpenter's hammer should possess the impact resistance, so that the chips do not peel off the striking face while working.

2.The hammer head should also be very hard, so that it does not deform while driving or eradicate any nails in wood.

3.Carpenter's hammer is used to impact smaller areas of an object.It can drive nails in the wood,can crush  the rock and shape the metal.It is not suitable for heavy work.

How hammer head is manufactured :

1.Hammer head is produced by metal forging process.

2.In this process metal is heated and this molten metal is placed in the cavities said to be dies.

3.One die is fixed and another die is movable.Ram forces the two dies under the forces which gives the metal desired shape.

4.The third process is repeated for several times.

5 0
2 years ago
Technician A that shielding gas nozzles may have different shapes. Technician B says that gelding gas nozzles is attached to the
Lilit [14]
B is correct! in this senecio
5 0
2 years ago
All of these are true about GMA (MIG) welding EXCEPT that:
Hatshy [7]

Answer:

the welding gun liner regulates the shielding gas.

Explanation:

The purpose of the welding gun liner is to properly position the welding wire from the wire feeder till it gets to the nozzle or contact tip of the gun. <em>Regulation of the shielding gas depends on factors such as the speed, current, and type of gas being used. </em>In gas metal arc welding, an electric arc is used to generate heat which melts both the electrode and the workpiece or base metal.

The electric arc produced is shielded from contamination by the shielding gas. The heat generated by the short electric arc is low.

3 0
1 year ago
A 75,000 ft3 clarifier is to be used to treat wastewater. The recycle ratio is 50%, the sludge volume index (SVI) is 125, and th
Inessa05 [86]

Answer:

11 hours approximately

Explanation:

We are to calculate mean cell residence time mcrt

= Mass of solid in reactor/mass of solid wasted in a day

Q = Qe + We

Q = 2.5

Qw = 0.5

Qe = 2.5 - 0.5

= 2 MGD

10⁶/svi

= 10⁶/125

= 8000

X = 3500

Xe = 20mg/

1MGD = 0.1337million

Mcrt = 75000x3500/[0.5*8000*10⁶+2*20*10⁶] x 0.1337

= 262500000/[4000000000+40000000} x 0.1337

= 262500000/574800000

= 0.45668 days

= 0.45668 x 24 hours

= 10.9603 hours

Approximately 11 hours

3 0
2 years ago
Other questions:
  • Consider insulation on a circular pipe For the same thickness and type of insulation, the thermal resistance of the insulation i
    8·1 answer
  • Radioactive wastes are temporarily stored in a spherical container, the center of which is buried a distance of 10 m below the e
    13·1 answer
  • The rigid bar CDE is attached to a pin support at E and rests on the 30 mm diameter brass cylinder BD. A 22 mm diameter steel ro
    8·1 answer
  • A steady tensile load of 5.00kN is applied to a square bar, 12mm on a side and having a length of 1.65m. compute the stress in t
    13·1 answer
  • Two physical properties that have a major influence on the cracking of workpieces, tools, or dies during thermal cycling are the
    13·1 answer
  • The purification of hydrogen gas is possible by diffusion through a thin palladium sheet. Calculate the number of kilograms of h
    8·1 answer
  • Refrigerant-134a enters the coils of the evaporator of a refrigeration system as a saturated liquid–vapor mixture at a pressure
    5·1 answer
  • In this module you learned about searching, sorting and algorithms in C++ and how to implement these elements in your C++ progra
    6·1 answer
  • A rectification column is fed 100 kg mol/h of a mixture of 50 mol % benzene and 50 mol % toluene at 101.32 kPa abs pressure. The
    5·1 answer
  • The BARO sensor informs the PCM about changes in weather and ____________________.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!