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]
2 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]2 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
Here, we want to become proficient at changing units so that we can perform calculations as needed. The basic heat transfer equa
netineya [11]

Answer:

9500 kJ; 9000 Btu

Explanation:

Data:

m = 100 lb

T₁ = 25 °C

T₂ = 75 °C

Calculations:

1. Energy in kilojoules

ΔT = 75 °C - 25 °C = 50 °C  = 50 K

m = \text{100 lb} \times \dfrac{\text{1 kg}}{\text{2.205 lb}} \times \dfrac{\text{1000 g}}{\text{1 kg}}= 4.54 \times 10^{4}\text{ g}\\\\\begin{array}{rcl}q & = & mC_{\text{p}}\Delta T\\& = & 4.54 \times 10^{4}\text{ g} \times 4.18 \text{ J$\cdot$K$^{-1}$g$^{-1}$} \times 50 \text{ K}\\ & = & 9.5 \times 10^{6}\text{ J}\\ & = & \textbf{9500 kJ}\\\end{array}

2. Energy in British thermal units

\text{Energy} = \text{9500 kJ} \times \dfrac{\text{1 Btu}}{\text{1.055 kJ}} = \text{9000 Btu}

7 0
3 years ago
What are the disadvantages of having a liquid cooled engine?
Feliz [49]
One notable disadvantage of liquid cooling over air cooling is that it is considerably costly to set up. Cooling fans are prevalent in the market, and this overabundance of supply means they are cheap. The components of a liquid cooling system can be expensive.
5 0
2 years ago
Explain why the following scenario fails to meet the criteria for proper reverse engineering.
avanturin [10]

Answer:

he must document or remember the order he took it apart so he put it back together

Explanation:

5 0
1 year ago
An equal-tangent sag vertical curve (with a negative initial and a positive final grade) is designed for 55 mi/h. The PVI is at
Varvara68 [4.7K]

Answer:

The lowest point of the curve is at 239+42.5 ft where elevation is 124.16 ft.

Explanation:

Length of curve is given as

L=2(PVT-PVI)\\L=2(242+30-240+00)\\L=2(230)\\L=460 ft

G_2 is given as

G_2=\frac{E_{PVT}-E_{PVI}}{0.5L}\\G_2=\frac{127.5-122}{0.5*460}\\G_2=0.025=2.5 \%

The K value is given from the table 3.3 for 55 mi/hr is 115. So the value of A is given as

A=\frac{L}{K}\\A=\frac{460}{115}\\A=4

A is given as

-G_1=A-G_2\\-G_1=4.0-2.5\\-G_1=1.5\\G_1=-1.5\%

With initial grade, the elevation of PVC is

E_{PVC}=E_{PVI}+G_1(L/2)\\E_{PVC}=122+1.5%(460/2)\\E_{PVC}=125.45 ft\\

The station is given as

St_{PVC}=St_{PVI}-(L/2)\\St_{PVC}=24000-(230)\\St_{PVC}=237+70\\

Low point is given as

x=K \times |G_1|\\x=115 \times 1.5\\x=172.5 ft

The station of low point is given as

St_{low}=St_{PVC}-(x)\\St_{low}=23770+(172.5)\\St_{low}=239+42.5 ft\\

The elevation is given as

E_{low}=\frac{G_2-G_1}{2L} x^2+G_1x+E_{PVC}\\E_{low}=\frac{2.5-(-1.5)}{2*460} (1.72)^2+(-1.5)*(1.72)+125.45\\E_{low}=124.16 ft

So the lowest point of the curve is at 239+42.5 ft where elevation is 124.16 ft.

3 0
3 years ago
Chlorine is one of the important commodity chemicals for the global economy. Before the advent of large scale
artcher [175]

The composition of gas in the feed, the percentage conversion and the

theoretical yield are combined to give the product stream composition.

Response:

The composition of gas in the product stream are;

  • HCl: 0.4 kmol/h, Cl₂: 1.6 kmol/h, H₂O: 1.6 kmol/h, O₂: 0.5 kmol/h

<h3>How can percentage conversion give the contents of the product stream?</h3>

The amount of oxygen used = 30% exceeding the theoretical amount

Number of moles of hydrochloric acid = 4 kmol/h

Percentage conversion = 80%

Required:

The composition of the gas in the product feed.

Solution;

The given reaction is; 4HCl + O₂ \longrightarrow 2Cl₂ + 2H₂O

Percentage \ conversion = \mathbf{ \dfrac{Moles \ of \ limiting \ reactant \ reacted}{Moles \  of \ limiting \ reactant \ supplied \ in \ the \, feed}}

Which gives;

80 \% = \mathbf{ \dfrac{Moles \ of \ limiting \ reactant \ reacted}{4 \, kmol/h}}

Moles of limiting reactant reacted = 4 kmol/h × 0.80 = 3.6 kmol/h

Which gives;

Number of moles of HCl in the stream = 4 kmol/h - 3.6 kmol/h = 0.4 kmol/h

Number of moles of Cl₂ produced = 2 kmol/h × 0.8 = 1.6 kmol/h

Similarly;

Number of moles of H₂O produced = 2 kmol/h × 0.8 = 1.6 kmol/h

Number of moles of O₂ in the product stream = 30% × 1 kmol/h + 20% × 1 kmol/h = 0.5 kmol/h

The composition of the production stream is therefore;

  • <u>HCl: 0.4 kmol/h</u>
  • <u>Cl₂: 1.6 kmol/h</u>
  • <u>H₂O: 1.6 kmol/h</u>
  • <u>O₂: 0.5 kmol/h</u>

Learn more about theoretical and actual yield here:

brainly.com/question/14668990

brainly.com/question/82989

7 0
2 years ago
Other questions:
  • A large plate is fabricated from a steel alloy that has a plane strain fracture toughness of 78 MPa (70.98 ksi). If the plate is
    7·1 answer
  • Determine the direct runoff and streamflow given the following unit hydrograph. The rainfall is collected at 4-hour intervals an
    14·1 answer
  • _______ is a material property that pertains to local resistance to plastic deformation, such as scratching or denting. It is of
    10·1 answer
  • python Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month an
    7·1 answer
  • WhT DO FILM PRODUTION SAY WHEN REMOVING GREEN AND BLUE SCREENS.
    14·1 answer
  • Selling a new vehicle pays a salesperson $1500. Selling a used vehicle pays a commission of 5% of the selling price. Write an in
    9·1 answer
  • The air loss rate for a straight truck or bus with the engine off and the brakes
    11·1 answer
  • Strands of materials A and B are placed under a tensile force of 10 Newtons. Material A deforms more than Material B.
    5·2 answers
  • What is the relationship between compressor work and COPR?
    14·1 answer
  • Reverse masking forms a soft edge on the panel.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!