Question

In: Computer Science

Pseudocode please: Assignment6B: For this assignment, you should ask the user for a day and a...

Pseudocode please:

Assignment6B: For this assignment, you should ask the user for a day and a month, then determine what season it is based on that input. Write a method that takes in a month and day and returns which season it is (“Spring”, “Summer”, “Fall”, “Winter”). Your main method should be the only one that includes a print statement. Note the first days of each season:

• March 19th – Spring

• June 20st – Summer

• September 22nd - Fall

• December 21st - Winter

Sample Output #1:

Enter a month: 6
Enter a day: 19
It is Spring!
Sample Output #2:
Enter a month: 6
Enter a day: 20
It is Summer!
Sample Output #3:
Enter a month: 2
Enter a day: 27
It is Winter!
Sample Output #4:
Enter a month: 7
Enter a day: 19
It is Summer!

Solutions

Expert Solution

Answer:-

Step1:- Ask the user for the month and date.

int m,d;
printf("Enter an month: ");
scanf("%d", &m);
printf("Enter an day: ");
scanf("%d", &d);

Step2:- We can use a switch statement for this type of question,

Step3:- To check the month first using switch & apply the if-else condition to check the date of season condition in each month.

Step4:-Check months, then date and print output

Likewise

input m

input d

switch(m)

case(1)

print "It is Winter!"

break

case(2)

print "It is Winter!"

break

case(3)

if d<19

print "It is Winter!"

else

print "It is Spring!"

break

case(4)

print "It is Spring!"

break

case(5)

print "It is Spring!"

break

case(6)

if d<20

print "It is Spring!"

else

print "It is Summer!"

break

case(7)

print "It is Summer!"

break

case(8)

print "It is Summer!"

break

case(9)

if d<22

print "It is Summer!"

else

print "It is Fall!"

break

case(10)

print "It is Fall!"

break

case(11)

print "It is Fall!"

break

case(12)

if d<21

print "It is Fall!"

else

print "It is Winter!"

break

Code for your refernce in c language:-

#include <stdio.h>

int main()
{
int m,d;
   printf("Enter an month: ");
    scanf("%d", &m); 
    printf("Enter an day: ");
    scanf("%d", &d);


switch(m){
    case 1:
        printf ("It is Winter!");
        break;
    case(2):
        printf ("It is Winter!");
        break;
    case(3):
        if (d<19){
            printf ("It is Winter!");}
        else{
            printf ("It is Spring!");}
        break;
    case(4):
        printf ("It is Spring!");
        break;
    case(5):
        printf ("It is Spring!");
        break;
    case(6):
        if (d<20){
            printf ("It is Spring!");}
        else{
            printf ("It is Summer!");}
        break;
    case(7):
        printf ("It is Summer!");
        break;
        
    case(8):
        printf ("It is Summer!");
        break;
    case(9):
        if (d<22){
            printf ("It is Summer!");}
        else{
            printf ("It is Fall!");}
        break;
    case(10):
        printf ("It is Fall!");
        break;
    case(11):
        printf; ("It is Fall!");
        break;
    case(12):
        if (d<21){
            printf ("It is Fall!");}
        else{
            printf ("It is Winter!");}
        break;
            
}
}

Output:-

If you need any help in understanding, please comment your query.

I tried my best for this question, I hope you upvote my answer.

Thank You


Related Solutions

Your Application should ask the user to enter their name and their salary.
Create a C# Console Application, name the solution Homework 6 and the project TaxRate.Your Application should ask the user to enter their name and their salary. Your application should calculate how much they have to pay in taxes each year and output each amount as well as their net salary (the amount they bring home after taxes are paid!). The only taxes that we will consider for this Application are Federal and FICA. Your Application needs to validate all numeric...
Ask the user for a filename, then ask the user for a line of text. Write...
Ask the user for a filename, then ask the user for a line of text. Write the line of text the filename specified by the user. The filename may be absolute or relative to the project directory.
Flowchart + Python. Ask the user for a value. Then, ask the user for the number...
Flowchart + Python. Ask the user for a value. Then, ask the user for the number of expressions of that value. Use While Loops to make a program. So then, it should be so that 5 expressions for the value 9 would be: 9 * 1 = 9 9 * 2 = 18 9 * 3 = 27 9 * 4 = 36 9 * 5 = 45 Flowcharts and Python Code. Not just Python code. I cannot read handwriting....
Ask the user how many days that they collected gems. A loop you write should loop...
Ask the user how many days that they collected gems. A loop you write should loop how many days the user enters. If the user enters 5 days, then the loop should loop 5 times to collect the data from each day. So, each loop iteration represents a day. In each loop iteration, ask the user how many gems they collected that day. After the loop finishes gathering the data for each day, calculate the total and average gems collected....
C++ Please For this assignment, you will write a program that lets the user play against...
C++ Please For this assignment, you will write a program that lets the user play against the computer in a variation of the popular blackjack car game. In this variation of the game, two-six sided dice are used instead of cards. The dice are rolled, and the player tries to beat the computer's hidden total without going over 21. Here are some suggestions for the game's design: Each round of the game is performed as an iteration of a loop...
This is in java, thank you! Problem2: In this problem you ask the user for a...
This is in java, thank you! Problem2: In this problem you ask the user for a month and day. You will then calculate the season based on the month and day. Create a class named Problem2 Create two integer instance variables, month and day. Create a constructor to initialize the both variables. The constructor should accept two arguments as parameters, m and d. Initialize the instance variables with these two values. Create a method called calcSeason. It should not have...
pseudocode please! Assignment 5B: Moneyball: Part 2. Similar to the previous assignment, you’re going to read...
pseudocode please! Assignment 5B: Moneyball: Part 2. Similar to the previous assignment, you’re going to read in the number of years the player played and the starting year of that player – followed by the statistics for those years. This time, however, you’re going to print out the years from worst to best in sorted order. Hint: this will require a second array to store years. If you can sort one array, can you sort both? Sample Output #1: Enter...
This assignment will ask you to look at your own finances. For this assignment, write a...
This assignment will ask you to look at your own finances. For this assignment, write a paragraph showing your percentages. I DO NOT want to know how much money you spend or have as income, I am only looking at the percentages. Describe for me what the effect of inflation is on you personally given what you found out. Look at a typical month of your expenditures and income. Create a list of your expenses by category (see below). Create...
what should this program do? Write a program (Lab8.cpp) that will ask the user for two...
what should this program do? Write a program (Lab8.cpp) that will ask the user for two file names. You will read the characters from each file and put them in separate queues. Then, you will read each character from each queue and compare it. If every character from both queues is the same, you will print “The files are identical.” Otherwise, you will print “The files are not identical.” Step-by-Step Instructions Create a character queue (named queue1) using the Standard...
Create a Netbeans project called LineNumbers The program should do the following: –Ask the user for...
Create a Netbeans project called LineNumbers The program should do the following: –Ask the user for how many lines of text they wish to enter –Declare and initialize an array of Strings to hold the user’s input –Use a while loop to prompt for and read the Strings (lines of text) from the user at the command line. Typically, this would be a 'for' loop since we know the number of times to execute the loop based upon the number...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT