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
a hallow steel tube 3.5m long has external diameter of 120mm. in order to determine the internal diameter the tube was subjected
Dafna1 [17]

Answer:

Please check the photo (solve)

4 0
3 years ago
2.11 Consider a 400 mm × 400 mm window in an aircraft. For a temperature difference of 90°C from the inner to the outer surface
alexandr402 [8]

Answer:

The heat loss rate through one of the windows made of polycarbonate is 252W. If the window is made of aerogel, the heat loss rate is 16.8W. If the window is made of soda-lime glass, the heat loss rate is 1190.4W.

The cost associated with the heat loss through the windows for an 8-hour flight is:

For aerogel windows: $17.472 (most efficient)

For polycarbonate windows: $262.08

For soda-lime glass windows: $1,238.016 (least efficient)

Explanation:

To calculate the heat loss rate through the window, we can use a model of heat transmission by conduction throw flat wall. Using unidimensional Fourier law:

\frac{dQ}{dt}=\dot Q =-kS\nabla \vec{T}

In this case:

\dot Q =k\frac{S}{L} \Delta T

If we replace the data provided by the problem we get the heat loss rate through one of the windows of each material (we only have to change the thermal conductivities).

To obtain the thermal conductivity of the soda-lime glass we use the graphic attached to this answer (In this case for soda-lime glass k₃₀₀=0.992w/m·K).

To calculate the cost associated with the heat loss through the windows for an 8-hour flight we use this formula (using the heat loss rate calculated in each case):

Cost=C_{hc}\cdot \dot Q \cdot t \cdot n=1\frac{\$}{Kwh} \cdot \dot Q \cdot 8h \cdot 130

6 0
3 years ago
Find the time-domain sinusoid for the following phasors:_________
sattari [20]

<u>Answer</u>:

a.  r(t) = 6.40 cos (ωt + 38.66°) units

b.  r(t) = 6.40 cos (ωt - 38.66°) units

c.  r(t) = 6.40 cos (ωt - 38.66°) units

d.  r(t) = 6.40 cos (ωt + 38.66°) units

<u>Explanation</u>:

To find the time-domain sinusoid for a phasor, given as a + bj, we follow the following steps:

(i) Convert the phasor to polar form. The polar form is written as;

r∠Ф

Where;

r = magnitude of the phasor = \sqrt{a^2 + b^2}

Ф = direction = tan⁻¹ (\frac{b}{a})

(ii) Use the magnitude (r) and direction (Φ) from the polar form to get the general form of the time-domain sinusoid (r(t)) as follows:

r(t) = r cos (ωt + Φ)

Where;

ω = angular frequency of the sinusoid

Φ = phase angle of the sinusoid

(a) 5 + j4

<em>(i) convert to polar form</em>

r = \sqrt{5^2 + 4^2}

r = \sqrt{25 + 16}

r = \sqrt{41}

r = 6.40

Φ = tan⁻¹ (\frac{4}{5})

Φ = tan⁻¹ (0.8)

Φ = 38.66°

5 + j4 = 6.40∠38.66°

(ii) <em>Use the magnitude (r) and direction (Φ) from the polar form to get the general form of the time-domain sinusoid</em>

r(t) = 6.40 cos (ωt + 38.66°)

(b) 5 - j4

<em>(i) convert to polar form</em>

r = \sqrt{5^2 + (-4)^2}

r = \sqrt{25 + 16}

r = \sqrt{41}

r = 6.40

Φ = tan⁻¹ (\frac{-4}{5})

Φ = tan⁻¹ (-0.8)

Φ = -38.66°

5 - j4 = 6.40∠-38.66°

(ii) <em>Use the magnitude (r) and direction (Φ) from the polar form to get the general form of the time-domain sinusoid</em>

r(t) = 6.40 cos (ωt - 38.66°)

(c) -5 + j4

<em>(i) convert to polar form</em>

r = \sqrt{(-5)^2 + 4^2}

r = \sqrt{25 + 16}

r = \sqrt{41}

r = 6.40

Φ = tan⁻¹ (\frac{4}{-5})

Φ = tan⁻¹ (-0.8)

Φ = -38.66°

-5 + j4 = 6.40∠-38.66°

(ii) <em>Use the magnitude (r) and direction (Φ) from the polar form to get the general form of the time-domain sinusoid</em>

r(t) = 6.40 cos (ωt - 38.66°)

(d) -5 - j4

<em>(i) convert to polar form</em>

r = \sqrt{(-5)^2 + (-4)^2}

r = \sqrt{25 + 16}

r = \sqrt{41}

r = 6.40

Φ = tan⁻¹ (\frac{-4}{-5})

Φ = tan⁻¹ (0.8)

Φ = 38.66°

-5 - j4 = 6.40∠38.66°

(ii) <em>Use the magnitude (r) and direction (Φ) from the polar form to get the general form of the time-domain sinusoid</em>

r(t) = 6.40 cos (ωt + 38.66°)

3 0
3 years ago
Aerospace engineers who work for certain government agencies are often required to have security clearance. Explain two reasons
yuradex [85]

Answer:

Two reasons that justify the requirement for security clearance for aerospace engineers working for government agencies are;

1) Such engineers have access to data regarding the blueprint, components, method of construction, functionality status, new systems design, future systems design, inventory of systems and aeronautical systems database which are sensitive information that are of high importance to the federal government

2) Such engineers take part in the testing of aeronautic equipment, and will require security clearance to be able to input data results into the data base of the aeronautic equipment

Explanation:

3 0
3 years ago
40 = 6(X^2) / 4 (tan(180/6)) solve for X
const2013 [10]

Answer:

x = 3.92

Explanation:

The question is given as ;

40 = 6x² / 4 tan { 180/6}

40 = 6x² / 4 tan {30°}

40 = 6x² / 2.309

40 * 2.309 = 6x²

92.38 = 6 x²

92.38/6 = x²

15.40 = x²

√15.40 = x

x = 3.92

3 0
3 years ago
Other questions:
  • 1. Get the trDFgrouped data starting from the May heavy day counts to the August heavy counts
    12·1 answer
  • (a) For BCC iron, calculate the diameter of the minimum space available in an octahedral site at the center of the (010) plane,
    10·1 answer
  • Refrigerant 134a is the working fluid in a vaporcompression heat pump that provides 35 kW to heat a dwelling on a day when the o
    14·1 answer
  • A piston-cylinder assembly has initially a volume of 0.3 m3 of air at 25 °C. Mass of the air is 1 kg. Weights are put on the pis
    15·1 answer
  • the oscillation of rod oa about o is defined by the relation θ= (3/pi)*(sin*pi*t), where theta and t are expressed in radians an
    8·1 answer
  • Oil is graded by the
    10·2 answers
  • What is programming and sensory?
    6·1 answer
  • In approximately 200 words, explain what three factors you believe will have the greatest impact on the future of the green buil
    11·1 answer
  • Thoughts on Anime?<br> Whats your fav
    10·2 answers
  • It is an important part of the differential maintenance which purpose is to make smoother the differential operation by lubricat
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!