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
11111nata11111 [884]
4 years ago
14

Seasons Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month a

nd 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 invalid, the output is: invalid The dates for each season are: spring: March 20 - June 20 summer: June 21 - September 21 autumn: September 22 - December 20 winter: December 21 - March 19
Computers and Technology
1 answer:
Ierofanga [76]4 years ago
3 0

Answer:

#include <iostream>

#include <string>

using namespace std;

int main() {

   string inputMonth;

   int inputDay;

   cin >> inputMonth >> inputDay;

   if (inputMonth == "January" && inputDay >= 1 && inputDay <= 31)

       cout << "Winter" << endl;

   else if (inputMonth == "February" && inputDay >= 1 && inputDay <= 29)

       cout << "Winter" << endl;

   else if (inputMonth == "April" && inputDay >= 1 && inputDay <= 30)

       cout << "Spring" << endl;

   else if (inputMonth == "May" && inputDay >= 1 && inputDay <= 30)

       cout << "Spring" << endl;

   else if (inputMonth == "July" && inputDay >= 1 && inputDay <= 31)

       cout << "Summer" << endl;

   else if (inputMonth == "August" && inputDay >= 1 && inputDay <= 31)

       cout << "Summer" << endl;

   else if (inputMonth == "October" && inputDay >= 1 && inputDay <= 31)

       cout << "Autumn" << endl;

   else if (inputMonth == "November" && inputDay >= 1 && inputDay <= 30)

       cout << "Autumn" << endl;

   else if (inputMonth == "March" && inputDay >= 20 && inputDay <= 31)

       cout << "Spring" << endl;

   else if (inputMonth == "June" && inputDay >= 1 && inputDay <= 20)

       cout << "Spring" << endl;

   else if (inputMonth == "June" && inputDay >= 21 && inputDay <= 30)

       cout << "Summer" << endl;

   else if (inputMonth == "September" && inputDay >= 1 && inputDay <= 21)

       cout << "Summer" << endl;

   else if (inputMonth == "September" && inputDay >= 22 && inputDay <= 30)

       cout << "Autumn" << endl;

   else if (inputMonth == "December" && inputDay >= 0 && inputDay <= 20)

       cout << "Autumn" << endl;

   else if (inputMonth == "December" && inputDay >= 21 && inputDay <= 30)

       cout << "Winter" << endl;

   else if (inputMonth == "March" && inputDay >= 1 && inputDay <= 19)

       cout << "Winter" << endl;

   else

       cout << "Invalid" << endl;

   return 0;

}

You might be interested in
EASY POINTS
Dmitry [639]
Its answer D because I took the same test and it told me that my answer was right that I put down and it was D.

3 0
3 years ago
I want an A! Write a pseudocode algorithm that asks the user for their grades in CSE 1321, along with their attendance, then cal
Vsevolod [243]

Answer:

The Java pseudocode and the Java code itself are given for better understanding

Explanation:

<u>Java pseudocode</u>

  1. preAvg(int test[], int qgrade):
  2. sum := 0
  3. for each testi in test:
  4. sum := sum + testi
  5. sum := sum + qgrade
  6. return sum / 5
  7. additional(int at):
  8. res = (at * 1.5) / 30
  9. return res
  10. total = preAvg(test, qgrade) + additional(at)

<u>Java code</u>

import java.util.Scanner;

public class CSE1322 {

  public static void main(String[] args) {

     

      Scanner scanner=new Scanner(System.in);

     

      int test[] = new int[4];

     

      for(int i=1;i<=4;i++){

          System.out.println("Enter your result for test"+i+": ");

          test[i-1] = scanner.nextInt();

      }

     

      System.out.println("Enter the average quiz grade: ");

      int qgrade = scanner.nextInt();

     

      System.out.println("Enter the classes you attended(out of 30): ");

      int at = scanner.nextInt();

     

      double avg = preAvg(test,qgrade);

      System.out.println("Your average before attendance is: "+avg);

     

      double add = additional(at);

      System.out.println("You receive an additional "+add+" points for attendance");

     

      double total = avg + add;

     

      System.out.println("Final grade is : "+total);

     

  }

  private static double additional(int at) {

      double res = ((double)at * 1.5)/30.0;

      return res;

  }

  private static double preAvg(int[] test, int qgrade) {

      double sum = 0;

     

      for(int i=0;i<4;i++) sum += test[i];

     

      sum += qgrade;

     

      return sum/5;

  }

}

4 0
4 years ago
NEED HELP
amid [387]

Answer:

i would do B

Explanation:

I YOUNGI

I MIDDLE I

I   AGED  I

I     MEH   I

I_______ I

\ kinda old/

  \ ____ /

   I OLD I

3 0
3 years ago
Nvm, Its B.
denis-greek [22]
B) which ice cream flavor do the most student prefer?
6 0
3 years ago
Terry came into work and turned on his computer. During the boot process, the computer shut down. When he tried again, the compu
krok68 [10]

el cable SATA porque sirve para la transferencia de datos entre la placa base y algunos dispositivos de almacenamiento como la unidad de disco duro (donde generalmente se instala el sistema operativo)

3 0
3 years ago
Other questions:
  • What new england industry quickly collapsed with the discovery of oil in pennsylvania
    9·2 answers
  • List and describe the issues that lead to making a successful website?​
    9·1 answer
  • An option button is a square button that enables you to make one choice among two or more options.
    15·1 answer
  • Two positive outcomes generally associated with modern computing are greater _____.
    12·2 answers
  • Is an important and necessary step that precedes object-oriented programming?
    6·1 answer
  • What is the advantage of postfix notation?
    6·1 answer
  • The light source for a typical silhouette is generally___________ the subject.
    12·2 answers
  • Match each item with a statement below. - Uses two keys: one to encrypt data and one to decrypt data - Encryption algorithm used
    9·1 answer
  • Why is it important to prepare the farm resources before you start working? explain​
    14·1 answer
  • A manager suspects that one of his team members has been fraudulently accessing confidential and sensitive information and breac
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!