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
____ [38]
3 years ago
13

Write a C++ program to display yearly calendar. You need to use the array defined below in your program. // the first number is

the month and second number is the last day of the month. into yearly[12][2] =
Engineering
1 answer:
ddd [48]3 years ago
3 0

Answer:

//Annual calendar

#include <iostream>

#include <string>

#include <iomanip>

void month(int numDays, int day)

{

int i;

string weekDays[] = {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"};

// Header print

      cout << "\n----------------------\n";

      for(i=0; i<7; i++)

{

cout << left << setw(1) << weekDays[i];

cout << left << setw(1) << "|";

}

cout << left << setw(1) << "|";

      cout << "\n----------------------\n";

      int firstDay = day-1;

      //Space print

      for(int i=1; i< firstDay; i++)

          cout << left << setw(1) << "|" << setw(2) << " ";

      int cellCnt = 0;

      // Iteration of days

      for(int i=1; i<=numDays; i++)

      {

          //Output days

          cout << left << setw(1) << "|" << setw(2) << i;

          cellCnt += 1;

          // New line

          if ((i + firstDay-1) % 7 == 0)

          {

              cout << left << setw(1) << "|";

              cout << "\n----------------------\n";

              cellCnt = 0;

          }

      }

      // Empty cell print

      if (cellCnt != 0)

      {

          // For printing spaces

          for(int i=1; i<7-cellCnt+2; i++)

              cout << left << setw(1) << "|" << setw(2) << " ";

          cout << "\n----------------------\n";

      }

}

int main()

{

int i, day=1;

int yearly[12][2] = {{1,31},{2,28},{3,31},{4,30},{5,31},{6,30},{7,31},{8,31},{9,30},{10,31},{11,30},{12,31}};

string months[] = {"January",

"February",

"March",

"April",

"May",

"June",

"July",

"August",

"September",

"October",

"November",

"December"};

for(i=0; i<12; i++)

{

//Monthly printing

cout << "\n Month: " << months[i] << "\n";

month(yearly[i][1], day);

if(day==7)

{

day = 1;

}

else

{

day = day + 1;

}

cout << "\n";

}

return 0;

}

//end

You might be interested in
Sun of first 1 nayural numbers​
marin [14]

Answer:

the answer is

n(n + 1)  \div 2

n(n+1)/2

4 0
3 years ago
Read 2 more answers
.a. What size vessel holds 2 kg water at 80°C such that 70% is vapor? What are the pressure and internal energy? b. A 1.6 m3 ves
vesna_86 [32]

Answer:

Part a: The volume of vessel is 4.7680m^3 and total internal energy is 3680 kJ.

Part b: The quality of the mixture is 90.3%  or 0.903, temperature is 120 °C and total internal energy is 4660 kJ.

Explanation:

Part a:

As per given data

m=2 kg

T=80 °C =80+273=353 K

Dryness=70% vapour =0.7

<em>From the steam tables at 80 °C</em>

Specific volume of saturated vapours=v_g=3.40527 m^3/kg

Specific volume of saturated liquid=v_f=0.00102 m^3/kg

Now the relation  of total specific volume for a specific dryness value is given as

                                  v=v_f+x(v_g-v_f)

Substituting the values give

v=v_f+x(v_g-v_f)\\v=0.00102+0.7(3.40527-0.00102)\\v_f=2.38399 m^3/kg

Now the volume of vessel is given as

v=\frac{V}{m}\\V=v \times m\\V=2.38399 \times 2\\V=4.7680 m^3

So the volume of vessel is 4.7680m^3.

Similarly for T=80 and dryness ratio of 0.7 from the table of steam

Pressure=P=47.4 kPa

Specific internal energy is given as u=1840 kJ/kg

So the total internal energy is given as

u=\frac{U}{m}\\U=u \times m\\U=1840 \times 2\\U=3680 kJ

The total internal energy is 3680 kJ.

So the volume of vessel is 4.7680m^3 and total internal energy is 3680 kJ.

Part b

Volume of vessel is given as 1.6

mass is given as 2 kg

Pressure is given as 0.2 MPa or 200 kPa

Now the specific volume is given as

v=\frac{V}{m}\\v=\frac{1.6}{2}\\v=0.8 m^3/kg

So from steam tables for Pressure=200 kPa and specific volume as 0.8 gives

Temperature=T=120 °C

Quality=x=0.903 ≈ 90.3%

Specific internal energy =u=2330 kJ/kg

The total internal energy is given as

u=\frac{U}{m}\\U=u \times m\\U=2330 \times 2\\U=4660 kJ

So the quality of the mixture is 90.3%  or 0.903, temperature is 120 °C and total internal energy is 4660 kJ.

5 0
3 years ago
An inductor has a 50.0-Ω reactance when connected to a 60.0-Hz source. The inductor is removed and then connected to a 45.0-Hz s
nignag [31]

Given:

X_{L} = 50.0 \ohm

frequency, f = 60.0 Hz

frequency, f' = 45.0 Hz

V_rms} = 85.0 V

Solution:

To calculate max current in inductor, I_{L(max):

At f = 60.0 Hz

X_{L} = 2\pi fL

50.0 = 2\pi\times 60.0\times L

L = 0.1326 H

Now, reactance X_{L} at f' = 45.0 Hz:

X'_{L} = 2\pi f'L

X'_{L} = 2\pi\times 45.0\times 0.13263 = 37.5\ohm

Now, I_{L(max) is given by:

I_{L(max) = \sqrt {\frac{2V_{rms}}{X'_{L}}}

I_{L(max) = \sqrt {\frac{2\times 85.0}{37.5}} = 2.13 A

Therefore,  max current in the inductor, I_{L(max) = 2.13 A

7 0
3 years ago
The dam cross section is an equilateral triangle, with a side length, L, of 50 m. Its width into the paper, b, is 100 m. The dam
lisabon 2012 [21]

Answer:

Explanation:

In an equilateral trinagle the center of mass is at 1/3 of the height and horizontally centered.

We can consider that the weigth applies a torque of T = W*b/2 on the right corner, being W the weight and b the base of the triangle.

The weigth depends on the size and specific gravity.

W = 1/2 * b * h * L * SG

Then

Teq = 1/2 * b * h * L * SG * b / 2

Teq = 1/4 * b^2 * h * L * SG

The water would apply a torque of elements of pressure integrated over the area and multiplied by the height at which they are apllied:

T1 = \int\limits^h_0 {p(y) * sin(30) * L * (h-y)} \, dy

The term sin(30) is because of the slope of the wall

The pressure of water is:

p(y) = SGw * (h - y)

Then:

T1 = \int\limits^h_0 {SGw * (h-y) * sin(30) * L * (h-y)} \, dy

T1 = \int\limits^h_0 {SGw * sin(30) * L * (h-y)^2} \, dy

T1 = SGw * sin(30) * L * \int\limits^h_0 {(h-y)^2} \, dy

T1 = SGw * sin(30) * L * \int\limits^h_0 {(h-y)^2} \, dy

T1 = SGw * sin(30) * L * \int\limits^h_0 {h^2 - 2*h*y + y^2} \, dy

T1 = SGw * sin(30) * L * (h^2*y - h*y^2 + 1/3*y^3)(evaluated between 0 and h)

T1 = SGw * sin(30) * L * (h^2*h - h*h^2 + 1/3*h^3)

T1 = SGw * sin(30) * L * (h^3 - h^3 + 1/3*h^3)

T1 = 1/3 * SGw * sin(30) * L * h^3

To remain stable the equilibrant torque (Teq) must be of larger magnitude than the water pressure torque (T1)

1/4 * b^2 * h * L * SG > 1/3 * SGw * sin(30) * L * h^3

In an equilateral triangle h = b * cos(30)

1/4 * b^3 * cos(30) * L * SG  > 1/3 * SGw * sin(30) * L * b^3 * (cos(30))^3

SG > SGw * 4/3* sin(30) * (cos(30))^2

SG > 1/2 * SGw

For the dam to hold, it should have a specific gravity of at leas half the specific gravity of water.

This is avergae specific gravity, including holes.

6 0
3 years ago
Identify parts of the E-Cig that constitute voltage, current, and resistance. Discuss the role each plays in the E-Cig and typic
Leno4ka [110]

Answer: c

Explanation:

7 0
2 years ago
Other questions:
  • A flocculation basin equipped with revolving paddles is 60 ft long (the direction of flow). 45 ft wide, and 14 ft deep and treat
    11·1 answer
  • Which of the following is an example of an iterative process?
    12·1 answer
  • Sophia is designing a new welding shop for the local high school. Where should the compressed gas and fuel cylinders be stored?
    15·1 answer
  • Define coordination number. How does this differ from atomic packing factor?
    7·1 answer
  • Which of the following tells the computer wha to do
    12·1 answer
  • If i build thing a and thing a builds thing b did i build thing b
    5·2 answers
  • If you have 300 skittles in a bag and you need to have 28 percent yellow. How many yellow skittles would you have to make a mini
    11·1 answer
  • What information in drawing's title block identifies the project?
    12·1 answer
  • How do Geothermal plowerplants relate to engineering?
    11·1 answer
  • The ratio between the modulating signal voltage and the carrier voltage is called?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!