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
Two wastewater treatment plant workers (one male and one female) are exposed to hydrogen sulfide in confined spaces in the treat
Vlada [557]

Answer:

Go to explaination for the details of the answer.

Explanation:

In order to determine the lifetime (75 years) chronic daily exposure for each individual, we have to first state the terms of our equation:

CDI = Chronic Daily Intake

C= Chemical concentration

CR= Contact Rate

EFD= Exposure Frequency and Distribution

BW= Body Weight

AT = Average Time.

Having names our variables lets create the equations that will be used to derive our answers.

Please kindly check attachment for details of the answer.

5 0
2 years ago
Consider the following grooves, each of width W, that have been machined from a solid block of material. (a) For each case obtai
kogti [31]

Answer:A certain vehicle loses 3.5% of its value each year. If the vehicle has an initial value of $11,168, construct a model that represents the value of the vehicle after a certain number of years. Use your model to compute the value of the vehicle at the end of 6 years.

Explanation:

8 0
3 years ago
When an object is moving, we use the following coefficient for friction calculations a)-μk b)-μs c)-γk d)- γs
Reika [66]

Answer:\mu_{k}

Explanation:

We use kinetic friction when a body is moving i.e. \mu_{k} for calculations.

Static friction is used when a body is in rest while kinetic friction is used when a body is moving and its value is quite low as compared to static friction .

Static friction value increases as we apply more force while kinetic friction occurs when there is relative motion between bodies.

3 0
3 years ago
In part A you are asked to write the pseudocode for the program. In part B you are asked to write the syntax of the code for the
Naya [18.7K]

Answer:

C++.

Explanation:

#include <iostream>

#include <string>

using namespace std;

///////////////////////////////////////////////////////////////

int main() {

   string quote, book;

   int page;

   

   cout<<"What is your favorite quote from a book?"<<endl;

   getline(cin, quote);

   cout<<endl;

   /////////////////////////////////////////////

   cout<<"What book was that quote from?"<<endl;

   getline(cin, book);

   cout<<endl;

   /////////////////////////////////////////////

   cout<<"What page was that quote from?"<<endl;

   cin>>page;

   cout<<endl;

   /////////////////////////////////////////////

   int no_of_upper_characters = 0;

   for (int i=0; i<quote.length(); i++) {

       if (isupper(quote[i]))

          no_of_upper_characters++;

   }

   

   cout<<"No. of upper case characters: "<<no_of_upper_characters<<endl;

   /////////////////////////////////////////////

   int no_of_characters = quote.length();

   cout<<"No. of characters: "<<no_of_characters<<endl;

   /////////////////////////////////////////////

   bool isDog = false;

   for (int i=0; i<quote.length(); i++) {

       if (isDog == true)

           break;

       else if (quote[i] == 'd') {

           for (int j=i+1; j<quote.length(); j++) {

               if (isDog == true)

                   break;

               else if (quote[j] == 'o') {

                   for (int z=j+1; z<quote.length(); z++) {

                       if (quote[z] == 'g') {

                           isDog = true;

                           break;

                       }

                   }

               }

           }

       }

   }

   

   if (isDog == true)

       cout<<"This includes 'd' 'o' 'g' in the quote";

   //////////////////////////////////////////////

   return 0;

}

3 0
3 years ago
A plate and frame heat exchanger has 15 plates made of stainless steel that are 1 m tall. The plates are 1 mm thick and 0.6 m wi
hodyreva [135]

Answer:

14.506°C

Explanation:

Given data :

flow rate of water been cooled = 0.011 m^3/s

inlet temp = 30°C + 273 = 303 k

cooling medium temperature = 6°C  + 273 = 279 k

flow rate of cooling medium = 0.02 m^3/s

Determine the outlet temperature

we can determine the outlet temperature by applying the relation below

Heat gained by cooling medium = Heat lost by water

= ( Mcp ( To - 6 )  =  Mcp ( 30 - To )

since the properties of water and the cooling medium ( water ) is the same

= 0.02 ( To - 6 ) = 0.011 ( 30 - To )

= 1.82 ( To - 6 ) = 30 - To

hence To ( outlet temperature ) = 14.506°C

6 0
3 years ago
Other questions:
  • Steam at 150 bars and 600°C passes through process equipment and emerges at 100 bars and 700°C. There is no flow of work into or
    8·1 answer
  • A steam power plant operates on an ideal Rankine cycle with two stages of reheat and has a net power output of 120 MW. Steam ent
    14·1 answer
  • A system consists of N very weakly interacting particles at a temperature T sufficiently high so that classical statistical mech
    9·1 answer
  • A wastewater treatment plant has two primary clarifiers, each 20m in diameter with a 2-m side-water depth. the effluent weirs ar
    8·1 answer
  • Part of the following pseudocode is incompatible with the Java, Python, C, and C++ language Identify the problem. How would you
    12·1 answer
  • A football player attempts a 30‐yd field goal. If he is able to impart a velocity u of 100 ft/sec to the ball, compute the minim
    6·1 answer
  • The value 100 MW is equivalent to (a) 100×10^6 w (b) 100 x 10^-6 w (c) 100 x 10^-3 w (d) 100 x 10^3 w
    14·1 answer
  • Calculate the number of vacancies per cubic meter at 1000∘C for a metal that has an energy for vacancy formation of 1.22 eV/atom
    14·1 answer
  • Please help me with this. Picture
    5·1 answer
  • 3. If nothing can ever be at absolute zero, why does the concept exist?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!