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
Oduvanchick [21]
3 years ago
10

For a project in C++ we are supposed toDesign a class named Month. The class should have the following private members:-name: a

string object that holds the name of the month, such as January.-monthName: an integer value that holds the number of the month. For example, January would be 1, February would be 2, and so on. Valid values for this variable should be from 1 to 12.In addition, provide the following member functions:-a default constructor that sets monthNumber to 1 and name to "January"-a constructor that accepts the name of the month as an argument and finds and prints how many days in that month. For example, January has 31 days, and so on.
Engineering
1 answer:
mart [117]3 years ago
7 0

Answer:

include <iostream>

using namespace std;

 

class Month

{

public:

 Month (char firstLetter, char secondLetter, char thirdLetter);

 

 Month (int monthNum);

.

 

 Month();

 void outputMonth_num();

 

 

 void outputMonthLetters();

private:

 int month;

};

 

 

int main ()

{

 //

 // Variable declarations

 //

 int monthNum;

 char firstLetter, secondLetter, thirdLetter;    

 char testAgain;              

 

 do {

 

   cout << endl;

   cout << "Testing the default constructor ..." << endl;

   Month defaultMonth;

   defaultMonth.outputMonth_num();

   defaultMonth.outputMonthLetters();

 

   //

   // Construct a month using the constructor with one integer argument

   //

   cout << endl;

   cout << "Testing the constructor with one integer argument..." << endl;

   cout << "Enter a month number: ";

   cin >> monthNum;

 

   Month testMonth1(monthNum);

   testMonth1.outputMonth_num();

   testMonth1.outputMonthLetters();

 

   //

   // Construct a month using the constructor with three letters as arguments

   //

   cout << endl;

   cout << "Testing the constructor with 3 letters as arguments ..." << endl;

   cout << "Enter the first three letters of a month (lowercase): ";

   cin >> firstLetter >> secondLetter >> thirdLetter;

   cout << endl;

 

   Month testMonth2(firstLetter, secondLetter, thirdLetter);

   testMonth2.outputMonth_num();

   testMonth2.outputMonthLetters();

 

   //

   // See if user wants to try another month

   //

   cout << endl;

   cout << "Do you want to test again? (y or n) ";

   cin >> testAgain;

 }

 while (testAgain == 'y' || testAgain == 'Y');

 

 return 0;

}

 

 

Month::Month(char firstLetter, char secondLetter, char thirdLetter)

{

if ((firstLetter == 'j')&&(secondLetter == 'a')&&(thirdLetter == 'n'))

  outputMonth_num = 1;

if ((firstLetter == 'f')&&(secondLetter == 'e')&&(thirdLetter == 'b'))

  outputMonth_num = 2;

if ((firstLetter == 'm')&&(secondLetter == 'a')&&(thirdLetter == 'r'))

  outputMonth_num = 3;

if ((firstLetter = 'a')&&(secondLetter == 'p')&&(thirdLetter == 'r'))

  outputMonth_num = 4;

if ((firstLetter == 'm')&&(secondLetter == 'a')&&(thirdLetter == 'y'))

  outputMonth_num = 5;

if ((firstLetter == 'j')&&(secondLetter == 'u')&&(thirdLetter == 'n'))

  outputMonth_num = 6;

if ((firstLetter == 'j')&&(secondLetter == 'u')&&(.thirdLetter == 'l'))

  outputMonth_num = 7;

if ((firstLetter == 'a')&&(secondLetter == 'u')&&(thirdLetter == 'g'))

  outputMonth_num = 8;

if ((firstLetter == 's')&&(secondLetter == 'e')&&(thirdLetter == 'p'))

  outputMonth_num = 9;

if ((firstLetter == 'o')&&(secondLetter == 'c')&&(thirdLetter == 't'))

  outputMonth_num = 10;

if ((firstLetter == 'n')&&(secondLetter == 'o')&&(thirdLetter == 'v'))

 outputMonth_num = 11;

if ((firstLetter == 'd')&&(secondLetter == 'e')&&(thirdLetter == 'c'))

 outputMonth_num = 12;

}

 

Month::inputMonthByNumber

{

if (Month_num > 12 && Month_num < 1)

cout << "Invalid number for Month, please choose 1-12)\n";

}

 

void Month::outputMonth_num()

{

 if (month >= 1 && month <= 12)

   cout ><< "Month: " << month << endl;

 else

   cout << "Error - The month is not a valid!" << endl;

}

 

void Month::outputMonthLetters()

{

 switch (month)

   {

   case 1:

     cout << "Jan" << endl;

     break;

   case 2:

     cout << "Feb" << endl;

     break;

   case 3:

     cout << "Mar" << endl;

     break;

   case 4:

     cout << "Apr" << endl;

     break;

   case 5:

     cout << "May" << endl;

     break;

   case 6:

     cout << "Jun" << endl;

     break;

   case 7:

     cout << "Jul" << endl;

     break;

   case 8:

     cout << "Aug" << endl;

     break;

   case 9:  

     cout << "Sep" << endl;

     break;

   case 10:

     cout << "Oct" << endl;

     break;

   case 11:

     cout << "Nov" << endl;

     break;

   case 12:

     cout << "Dec" << endl;

     break;

   default:

     cout << "Error - the month is not a valid!" << endl;

   }

}

You might be interested in
Which of the following impulse responses correspond(s) to stable LTI systems? (a) h1(t) = e-(1-2j)ru(t) (b) h2(t) = e-r cos(2t)u
Illusion [34]

Answer:

LTI system is stable if Impulse response is finite.

so the correct answer is "b"

(b) h2(t) = e-r cos(2t)u(t)

6 0
4 years ago
University administrators have developed a Markov model to simulate graduation rates at their school. Students might drop out, r
abruzzese [7]

Solution :

The percentage of the students who have a chance of repeating their current year = 3%

The drop out students for the first year and the sophomores = 6%

Drop out rate of first year and the seniors = 4%

Now for the state space :

S = { first year(1), sophomores(2), juniors(3), seniors(4), graduates(G), Dropouts(D) }

Therefore

the first year students are indicated as '1'

Sophomores are indicated as '2'

Juniors are indicated as '3'

Seniors are indicated as '4

Graduates are indicated as 'G'

Dropouts are indicated as 'D'

The transition diagram is attached below.

The probability of the students who have the chance of repeating their current year = 3/100 = 0.03

Probability of first year dropouts and sophomores = 6/100 = 0.06

Probability of dropout rate of juniors and seniors = 4/100 = 0.04

Therefore, the probability matrix can be made as :

              1        2        3        4       G        D

    \begin{matrix}1\\ 2\\ 3\\ 4\\ G\\ D\end{matrix}      \begin{bmatrix}0.03 & 0.91 & 0 & 0 & 0 & 0.06\\  0& 0.03 & 0.91 & 0 & 0 & 0.06\\  0& 0 & 0.03 & 0.93 & 0 & 0.04\\  0& 0 & 0 & 0.03 & 0.93 & 0.04\\  0& 0 & 0 & 0 & 1 & 0\\  0& 0 & 0 & 0 & 0 & 1\end{bmatrix}  

Here, G represents 'graduates' and D represents 'Dropouts.'

5 0
3 years ago
PLLEEAASSSEEE HELP I KNOW NOTHING ABOUT THIS STUFF
erastovalidia [21]
So 20 plus 60 = 40 then
5 0
3 years ago
Find the second derivative of: y = sqrt(x + 4)/4; x ≥ -4.
hammer [34]

Answer: \dfrac{-1}{16(x+4)^{\frac{3}{2}}}

Explanation:

Given

y=\dfrac{\sqrt{x+4}}{4}\\\text{differentitate w.r.t x}\\\dfrac{\mathrm{d} y}{\mathrm{d} x}=\dfrac{1}{4}\times \dfrac{1}{2\sqrt{x+4}}=\dfrac{1}{8\sqrt{x+4}}

\dfrac{\mathrm{d} y}{\mathrm{d} x}=\dfrac{(x+4)^{-0.5}}{8}

Again differentiate for the second derivative

\frac{\mathrm{d^2} y}{\mathrm{d} x^2}=\dfrac{1}{8}\times \dfrac{-1}{2(x+4)^{\frac{3}{2}}}=\dfrac{-1}{16(x+4)^{\frac{3}{2}}}

8 0
3 years ago
Read 2 more answers
Problem 4.041 SI Refrigerant 134a enters an insulated compressor operating at steady state as saturated vapor at -26oC with a vo
Rom4ik [11]

Answer:

0.0297M^3/s

W=68.48kW

Explanation:

Hello! To solve this problem, we must first find all the thermodynamic properties at the input (state 1) and the compressor output (state 2), using the thermodynamic tables

Through laboratory tests, thermodynamic tables were developed, these allow to know all the thermodynamic properties of a substance (entropy, enthalpy, pressure, specific volume, internal energy etc ..)  

through prior knowledge of two other properties such as pressure and temperature.  

state 1

X=quality=1

T=-26C

density 1=α1=5.27kg/m^3  

entalpy1=h1=234.7KJ/kg

state 2

T2=70

P2=8bar=800kPa

density 2=α2=31.91kg/m^3  

entalpy2=h2=306.9KJ/kg

Now to find the flow at the outlet of the compressor, we remember the continuity equation that states that the mass flow is equal to the input and output.

m1=m2

(Q1)(α1)=(Q2)(α2)

\frac{(Q1)(\alpha 1) }{\alpha 2} =Q2\\Q2=\frac{(0.18)(5.27) }{31.91} =0.0297M^3/s

the volumetric flow rate at the exit is 0.0297M^3/s

To find the power of the compressor we use the first law of thermodynamics that says that the energy that enters must be equal to the energy that comes out, in this order of ideas we have the following equation

W=m(h2-h1)

m=Qα

W=(0.18)(5.27)(306.9-234.7)

W=68.48kW

the compressor power is 68.48kW

4 0
3 years ago
Other questions:
  • Insulated Gas Turbine Air enters an adiabatic gas turbine at 1050 K and 1 MPa and leaves at 400 kPa. Kinetic and potential energ
    14·1 answer
  • Compare the use of a low-strength, ductile material (1018 CD) in which the stress-concentration factor can be ignored to a high-
    15·1 answer
  • Communication "works" to the degree that a wide variety of information is completely and thoroughly shared among the parties, an
    13·1 answer
  • Consider unsteady fully developed Coutte flow between two infinite parallel plates. This problem involves the following paramete
    5·1 answer
  • A 90-hp (shaft output) electric car is powered by an electric motor mounted in the engine compartment. If the motor has an avera
    8·1 answer
  • PLZZZZZ HELP
    7·2 answers
  • Problematic substances mechanical engeneering???
    6·1 answer
  • 1 point
    6·1 answer
  • People in accounting record, classify, summarize, analyze, and communicate a business's financial information for use in managem
    9·1 answer
  • Consider the 'scope trace showing the input signal to an rc filter (the one having the larger amplitude) and the output of the f
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!