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
A work element in a manual assembly task consists of the following MTM-1 elements: (1) R16C, (2) G4A, (3) M10B5, (4) RL1, (5) R1
ella [17]

Answer:

a)

1) R16C ; Tn = 17 TMU

2) G4A ; Tn = 7.3 TMU

3) M10B5 ; Tn = 15.1 TMU

4) RL1 ; Tn = 2 TMU

5) R14B ; Tn = 14.4 TMU

6) G1B ; Tn = 3.5 TMU

7) M8C3 ; Tn = 14.7 TMU

8) P1NSE ; Tn = 10.4 TMU

9) RL1 ; Tn = 2 TMU

b) 3.1 secs

Explanation:

a) Determine the normal times in TMUs for these motion elements

1) R16C ; Tn = 17 TMU

2) G4A ; Tn = 7.3 TMU

3) M10B5 ; Tn = 15.1 TMU

4) RL1 ; Tn = 2 TMU

5) R14B ; Tn = 14.4 TMU

6) G1B ; Tn = 3.5 TMU

7) M8C3 ; Tn = 14.7 TMU

8) P1NSE ; Tn = 10.4 TMU

9) RL1 ; Tn = 2 TMU

b ) Determine the total time for this work element in seconds

first we have to determine the total TMU = ∑ TMU = 86.4 TMU

note ; 1 TMU = 0.036 seconds

hence the total time for the work in seconds = 86.4 * 0.036 = 3.1 seconds

7 0
2 years ago
Openings around pipes that enter building should be covered by
algol [13]

Answer: I have 2 suggestions: one, maybe, maybe, use some of that metal tape that you get at hardware places, and: two, buy a new pipe (or pipes), two be sure that it won't happen again. Have a good day, and thanks for asking the brain!

Explanation:

7 0
2 years ago
Water is the working fluid in an ideal Rankine cycle. The condenser pressure is 8 kPa, and saturated vapor enters the turbine at
sergeinik [125]

Explanation:

The obtained data from water properties tables are:

Point 1 (condenser exit) @ 8 KPa, saturated fluid

h_{f} = 173.358 \\h_{fg} = 2402.522

Point 2 (Pump exit) @ 18 MPa, saturated fluid & @ 4 MPa, saturated fluid

h_{2a} =  489.752\\h_{2b} =  313.2

Point 3 (Boiler exit) @ 18 MPa, saturated steam & @ 4 MPa, saturated steam

h_{3a} = 2701.26 \\s_{3a} = 7.1656\\h_{3b} = 2634.14\\s_{3b} = 7.6876

Point 4 (Turbine exit) @ 8 KPa, mixed fluid

x_{a} = 0.8608\\h_{4a} = 2241.448938\\x_{b} = 0.9291\\h_{4b} = 2405.54119

Calculate mass flow rates

Part a) @ 18 MPa

mass flow

\frac{100*10^6 }{w_{T} - w_{P}} = \frac{100*10^3 }{(h_{3a}  - h_{4a}) - (h_{2a}  - h_{f})}\\\\= \frac{100*10^ 3}{(2701.26  - 2241.448938 ) - (489.752  - 173.358)}\\\\= 697.2671076 \frac{kg}{s} = 2510161.587 \frac{kg}{hr}

Heat transfer rate through boiler

Q_{in}  = mass flow * (h_{3a} -  h_{2a})\\Q_{in} = (697.2671076)*(2701.26-489.752)\\\\Q_{in} = 1542011.787 W

Heat transfer rate through condenser

Q_{out}  = mass flow * (h_{4a} -  h_{f})\\Q_{out} = (697.2671076)*(2241.448938-173.358)\\\\Q_{out} = 1442011.787 W

Thermal Efficiency

n = \frac{W_{net}  }{Q_{in} } = \frac{100*10^3}{1542011.787}  \\\\n = 0.06485

Part b) @ 4 MPa

mass flow

\frac{100*10^6 }{w_{T} - w_{P}} = \frac{100*10^3 }{(h_{3b}  - h_{4b}) - (h_{2b}  - h_{f})}\\\\= \frac{100*10^ 3}{(2634.14  - 2405.54119 ) - (313.12  - 173.358)}\\\\= 1125 \frac{kg}{s} = 4052374.235 \frac{kg}{hr}

Heat transfer rate through boiler

Q_{in}  = mass flow * (h_{3b} -  h_{2b})\\Q_{in} = (1125.65951)*(2634.14-313.12)\\\\Q_{in} = 2612678.236 W

Heat transfer rate through condenser

Q_{out}  = mass flow * (h_{4b} -  h_{f})\\Q_{out} = (1125)*(2405.54119-173.358)\\\\Q_{out} = 2511206.089 W

Thermal Efficiency

n = \frac{W_{net}  }{Q_{in} } = \frac{100*10^3}{1542011.787}  \\\\n = 0.038275

6 0
3 years ago
What information you would gain by watching the video. Plz Help due today.
Archy [21]

Answer: It doesnt let me watch the link im sorry :(

Explanation:

3 0
2 years ago
A collection of electrons in one place is known as what
quester [9]
A collection of electrons lol
8 0
2 years ago
Other questions:
  • Five bolts are used in the connection between the axial member and the support. The ultimate shear strength of the bolts is 320
    5·1 answer
  • The position of a particle moving along a straight line is defined by the relation. s = t^3 – 6t^2 – 15t + 40, where s is expres
    13·1 answer
  • Electrical strain gauges were applied to a notched specimen to determine the stresses in the notch. The results were εx=0.0019 a
    13·1 answer
  • How to solve this question
    11·1 answer
  • Using the idea of mass and change of speed... could a bowling ball be thrown so fast that it has the same force as a car driving
    7·1 answer
  • Define what a glass transition is and what happens to a polymer because of it
    13·1 answer
  • How do we need to prepare for the future?
    10·1 answer
  • What careers could you potential do if you
    5·1 answer
  • The Role of Fuel Cells in Renewable Energy Solutions
    5·1 answer
  • Write an<br> algorithm and draw a flowchart to convert the length in feet to<br> centimeter
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!