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
seropon [69]
3 years ago
5

Listed below are snippets from a prgram to perform input validation for

Engineering
1 answer:
leva [86]3 years ago
3 0

Answer:

#include <iostream>

#include <string>

#include "user.h"

#include "password.h"

using namespace Authenticate;

using namespace std;

int main()

{

inputUserName();

inputPassword();

cout << "Your username is " << getUserName() <<

" and your password is: " <<

getPassword() << endl;

return 0;

}

user.h:

#ifndef USER_H

#define USER_H

#include <string>

using namespace std;

namespace Authenticate

{

namespace

{

bool isvalid();

}

void inputUserName();

string getUserName();

}

#endif

user.cpp:

#include <iostream>

#include "user.h"

namespace Authenticate

{

string username="";

namespace

{

bool isvalid()

{

if(username.length() == 8)

return true;

else

return false;

}

}

void inputUserName(){

do

{

cout << "Enter your username (8 letters only)" << endl;

cin >> username;

}

while(!isvalid());

}

string getUserName()

{

return username;

}

}

password.h:

#ifndef PASSWORD_h

#define PASSWORD_h

#include <string>

using namespace std;

namespace Authenticate

{

namespace

{

bool isValid();

}

void inputPassword();

string getPassword();

}

#endif

password.cpp:

#include <iostream>

#include <string>

using namespace std;

namespace Authenticate

{

string password="";

namespace

{

bool isValid()

{

if(password.length() >= 8)

{

for(int i=0; i<password.length(); i++)

if(password[i] >= '0' && password[i] <= '9')

return true;

return false;

}

else

return false;

}

}

void inputPassword(){

do

{

cout << "Enter your password (at least 8 characters " <<

"and at leat one non-letter)" << endl;

cin >> password;

}

while(!isValid());

}

string getPassword()

{

return password;

}

}

You might be interested in
At what distance from the Earth’s surface is a 10,000 kg satellite if its potential energy is equal to –5.58 x 1011 J? (choose t
Maksim231197 [3]

Answer:

Option D

Explanation:

As we know

Gravitational Constant (G) = 6.67*10^{11}

Mass of Earth (M) = 5.98*10^{24}

Weight of satellite (m) = 10,000 Kg

Radius of Earth (R) = 6.378*10^6

Distance of satellite from Earth = \frac{GMm}{R} - U

Substituting the given values, we get

D=\frac{(-((6.67*10^{11})(5.98*10^{24})(10000))}{(6.378*10^6)} - (-5.58*10^{11})\\\\0.625*10^{3}Km

or 635 m

The correct answer is option D

3 0
3 years ago
Who here is a genius?
Pachacha [2.7K]

Answer:

im kinda smart  whyy?

Explanation:

3 0
3 years ago
Read 2 more answers
A rectangular beam having b=300 mm and d=575 mm, spans 5.5 m face to face of simple supports. It is reinforced for flexure with
katovenus [111]

Answer:

provide 180 mm spacing

Explanation:

GIVEN DATA

rectangular beam: (b) = 300 mm, (d) = 575 mm

reinforced for flexure = 4Ф32 bars

WD = 30 kN /m,  WL = 45 kN/m

Wu = 1.4 * 30 + 1.6 * 45 = 114 kN/m

i) concrete shear stress ( vc)

100 Ac / bd = (100 * u * \frac{\pi }{4} *  32^2) / 300 * 575 = 1.865

from table 3.8

when:  100 Ac / bd = 1.865  then Vc = 0.778 N/mm^2

Ultimate shear force = (114 *5.5) / 2 = 313.5 kN

design shear stress =  V / bd = (313.5 * 10^3) / (300 * 575) = 1.82 N/mm^2

v < 0.8\sqrt{22}   =      1.82 < 3.75

design link provided  according to

Asv / sv =  b(v-vc) / 0.87 fy  = 300(1.82 - 0.778) / 0.87 (420)

ASv / Sv = 0.855

From table 3.13 :the value of Asv / sv can be calculated as

\frac{0.855 - 0.785}{0.897 - 0.785}  = \frac{x - 200}{175 - 200}

x = (-25) [ 0.625] + 200 = 184.375 mm

provide 180 mm spacing

8 0
4 years ago
Nonshielded cable with a 1.5-inch diameter should have a minimum bending radius of
Flura [38]

Answer:

c is the answer because we have to double the number

6 0
2 years ago
A photovoltaic panel of dimension 2m×4m is installed on the
blsea [12.9K]

Answer:

Explanation:

Simply put, a solar panel works by allowing photons, or particles of light, to knock electrons free from atoms, generating a flow of electricity. Solar panels actually comprise many, smaller units called photovoltaic cells. (Photovoltaic simply means they convert sunlight into electricity. The attached diagram give an ilustsration of the photovotaic pannel mounted on a roof top.

Solution

To Determine the electric power generated for

a) A still summer day.

E = A * r * H * PR

E = Total Amount of Energy in kilowatt

A = Total Surface Area

r = efficiency Rating

H = global radiation value

PR = Performance Ratio

kwh = watt * Time/1000

kwh = 100 * 35/1000

3.5

b)

kwh = watt * Time/1000

kwh = 30 *15/1000

4.5

6 0
3 years ago
Other questions:
  • The chief engineer at a university that is constructing large number of new student dormitories decides install a counterflow co
    12·1 answer
  • An alternating current E(t) =120 sin(12t) has been running through a simple circuit for a long time. The circuit has an inductan
    6·1 answer
  • How dose iorn get forged itno steel?
    10·1 answer
  • There are three MUXes in the EX stage. Among them, the 2 MUXes located at the top is meant to provide correct ALU source data 1
    13·1 answer
  • Select the correct answer.
    11·2 answers
  • What does the supply chain management process involve
    6·1 answer
  • Calculate the torque produced by a motor that has 500 windings across a 30cm diameter rotating core. The core is 0.6 M long insi
    12·1 answer
  • Henry is given a task to divide a segment into six equal parts, using a triangle and a compass. How many arcs would he need to c
    10·1 answer
  • What is an advantage of a nuclear-fission reactor?.
    11·1 answer
  • Two current coils are installed. What is their function and why
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!