Question: What would I put for the coding for this problem? Every year, salmon return from the salt water they usually live in to a freshwater

Every year, salmon return from the salt water they usually live in to a freshwater river to spawn (lay eggs). Some people like to go and watch the salmon swim upstream to their favorite spawning places, especially at fish farms. There are several different varities of salmon. Some spawn in the spring and most spawn in the fall. Your task is to write a program that takes the month of the year as an integer and output if it is "Spring spawning season". "Fall spawning season", or "Not spawning season". The spring spawning season lasts from March to June (month 3 - 6). The fall spawning season lasts from September to November (month 9 - 11). Remember that in an if-else if statement, the first if statement that evaluates to true is the one whose body is executed. Therefore, you will need to check the months in numerical order. Follow the comments in main to help you with this algorithm. 1 import java.util.Scanner; 3 public class Salmon 4- { 5 public static void main(String[] args) 6 - { 7 Scanner input = new Scanner(System.in); 8 9 // Ask user for month of year as an integer 10 11 // if month is less than 3 (Jan or Feb) not spawning season 12 // else if month is less than 7 march, april, may, june) spri 13 11 else if month is less than 9 (july, august) Not spawning se 14 Il else if month is less than 12 (sept, oct, nov) fall spawnin 15 // else (only month left is december) -- not spawning season 16 17 18 // Note: because of the way this code is structured, // if you enter 2, every single one of these boolean 20 // statements is true. But only the FIRST one executes! 21 // Hence, we check for less than 3 to catch jan and feb, etc 22 23 3 24 ] 19
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
