SourceCode:
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile
and execute it.
*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
int month=0;
int day;
cout<<"Enter month(1 to 12):";
cin>>month;
while(month <0 || month >12) {
cout<<"Enter valid month b/w 1 to 12:";
cin>>month;
}
cout<<"Enter day(1 to 30):";
cin>>day;
while(day <0 || day >30) {
cout<<"Enter valid day(1 to 30):";
cin>>day;
}
string season="";
//If month is 1, 2 or 3, season = “Winter”
if(month >= 1 && month <=3)
season = "Winter";
//Else if month is 4, 5 or 6, season = “Spring”
else if(month >= 4 && month <=6)
season = "Spring";
//Else if month is 7, 8, or 9, season = “Summer”
else if(month >= 7 && month <=9)
season = "Summer";
// Else if month is 10, 11, or 12, season = “Fall”
else if(month >= 10 && month <=12)
season = "Fall";
// If month is divisible by 3 and day is greater than or equal
to 21
if(month % 3 == 0 && day >=21) {
if(season=="Winter")
// If season is winter, season equals “spring”
season = "Spring";
// Else if season is spring, season equal “summer”
else if(season=="Spring")
season = "Summer";
// Else if season is summer, season equals “fall”
else if(season=="Summer")
season = "Fall";
// Else season equals winter
else
season = "Winter";
}
cout<<"season: "<< season << endl;
return 0;
}
Output:
//Hi, please comment in here in
case of any queries and do rate the solution if it is
helpful...Thanks
Question #7. (8 points) (P313) The following algorithm yields the season (Spring, Summer, Fall or Winter)...
The administrator of a hospital is interested in predicting the amount of gross patient revenue that the organization expects to earn during the winter, spring, summer, and fall of the next year. the following data represent the gross patient revenue earned in the past 6 years. Season Time Gross Revenue Moving average Winter 1 36 Spring 2 27 Summer 3 15.1 Fall 4 37.8 = Winter 5 47.6 Spring 6 41.4 Summer 7 26.9 Fall 8 51.7 Winter 9 53.3...
Use R to solve these problems
8. The year is divided into four seasons: spring, summer, fall and winter While the exact dates that the seasons change vary a little bit from year to year because of the way that the calendar is constructed, we will use the following dates for this exercise: Season rin Summer Fall Winter Start March June September December End Ma August November Februa Create a program that reads a month from the user. The user...
C++ Help. Any help is appreciated, thank you very much! Write a C++ program that asks the user for the month of the year (as a number), and prints “Happy Winter” if it is strictly before 3 or strictly larger than 11, “Happy Spring” if it is 3 or greater, but strictly before 7, and “Happy Summer” if it is 7 or greater, but strictly before 9, and “Happy Fall” otherwise. A sample run: Enter month (as a number): 12...
Create a function that will accept a date as input and will
return if this date happens in fall, spring, winter or summer.
Before you start writing this function experiment with queries
below.
Current date
select sysdate from dual;
Yesterday
select sysdate - 1 from dual;
Tomorrow
select sysdate + 1 from dual;
The date format element D returns the number of the day of the
week (1-7).
select to_char(sysdate,'D') from
dual;
MM returns two-digit numeric abbreviation of month (01-12;...
Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day. Ex: If the input is: April 11 the output is: Spring In addition, check if the string and int are valid (an actual month and day). Ex: If the input is: Blue 65 the output is: Invalid The dates for each season are: Spring: March 20 - June 20 Summer:...
The administrator of a hospital is interested in predicting the amount of gross patient revenue that the organization expects to earn during the winter, spring, summer, and fall of the next year. the following data represent the gross patient revenue earned in the past 6 years. Season Time Gross Revenue Winter 1 36 Spring 2 27 Summer 3 15.1 Fall 4 37.8 Winter 5 47.6 Spring 6 41.4 Summer 7 26.9 Fall 8 51.7 Winter 9 53.3 Spring 10 44.7...
Question #7 (5 points) Attendance at Los Angeles's newest Disney!ike attraction, Vacation World, has been as follows: uarter Winter1 ing 11 Summer 11 Fall '11 Winter '12 Spring '12 Guests (in thousands) Quarter 73 104 168 74 65 82 Summer '12 Fall 12 Winter 13 Spring '13 Summer 13 Fall 13 Guests (in thousands 124 52 89 146 205 98 Compute seasonal indices using all of the data.
24. Consider the following C++ code. (6, 8) string seasons [4](*Winter", "Spring", "Summer", "Falla) stringstrPtr; strPtr new string[5]; for (int į = 0; i < 4; i++) strPtr liseasons [i] a. Write a C++ code that outputs the contents of the array to whiclh strPtr points. Write the C++ statement that deallocates the memory space occu- pied by the array to which strptr points b.
in python
Worth 5 points (Science: day of the week) Zeller's congruence is an algorithm developed by Christian Zeller to calculate the day of the week. The formula is h= (q + 26(m+1)//10 + k + k//4 +j//4 +5j) % 7 where - h is the day of the week (0: Saturday, 1: Sunday, 2: Monday, 3: Tuesday, 4: Wednesday, 5: Thursday, 6: Friday). - is the day of the month. m is the month (3: March, 4: April, ...,...
Zeller's congruence is an algorithm developed to calculate the day of the week. Write a program that prompts the user to enter a year, month, day of month and it displays the name of the week. Here is my source code. I need it broke down into a flowchart. public static void main(String[] args) { //all variables are initialized to 0, because local variables require at least an initial value before use Scanner input = new...