Dates for each season: Spring: March 20 - June 20 Summer: June 21 - September 21...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Dates for each season: Spring: March 20 - June 20 Summer: June 21 - September 21 Autumn: September 22 - December 20 Winter: December 21 - March 19 Sample Output: Enter a date (String, int): April 11 April 11 falls during Spring Enter a date (String, int): Blue 65 You entered an invalid date. Part 2: Seasons (Switch) TO DO: Solve the Seasons problem (described in Part 1) again, but this time, you should only use a switch statement (i.e. no IF, IF-ELSE or ELSE-IF). The desired output will remain the same. Name this program SeasonsSwitch.java Remember: Adhere to good programming practices (includes a header, comments, proper indentation, and descriptive variable names using camelCase) 4 Q 14 A File Edit Selection View Go Run Terminal Help J Cards.java 3 J Seasons.java 2 J SeasonsSwitch.java 2 C: > Users > 14848 > Documents > readings > J SeasonsSwitch.java > SeasonsSwitch > main(String[]) 7 import java.util.Scanner; 8 public class Seasons Switch { 0A7 9 PEGADGANG 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 PROBLEMS Run | Debug public static void main (String[] args) { Scanner sc = new Scanner(System.in); System.out.println(x: "Enter a date (String, int): "); String month = sc.next(); int day = sc.nextInt (); String season = ""; switch (month) { case "March": season=("Spring"); System.out.println( month+day + " falls under " + season); break; SeasonsSwitch.java - Visual Studio Code case "April": season=("Spring"); System.out.println( month + day + " falls under " break; case "May": OUTPUT DEBUG CONSOLE TERMINAL Type here to search + season); Septmber 11 invalid number PS C:\Users\14848> & 'C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot\bin\java.exe' '-cp' 'C:\Users\14848\AppData\Local\Temp\vscodesws_ 5718f\jdt_ws\jdt.1s-java-project\bin' 'SeasonsSwitch' Enter a date (String, int): September 67 September67 falls under Summer PS C:\Users\14848> HH | ? ! Launch Seasons IA XI Ln 15, Col 10 Spaces: 4 68F 08 UTF-8 CRLF I x tv ^ x Run: Seasons Run: Season... Run: Season... Run: Season... Run: Season... Run: Season... Run: Season... {} Java 4:50 PM 9/11/2022 Dates for each season: Spring: March 20 - June 20 Summer: June 21 - September 21 Autumn: September 22 - December 20 Winter: December 21 - March 19 Sample Output: Enter a date (String, int): April 11 April 11 falls during Spring Enter a date (String, int): Blue 65 You entered an invalid date. Part 2: Seasons (Switch) TO DO: Solve the Seasons problem (described in Part 1) again, but this time, you should only use a switch statement (i.e. no IF, IF-ELSE or ELSE-IF). The desired output will remain the same. Name this program SeasonsSwitch.java Remember: Adhere to good programming practices (includes a header, comments, proper indentation, and descriptive variable names using camelCase) 4 Q 14 A File Edit Selection View Go Run Terminal Help J Cards.java 3 J Seasons.java 2 J SeasonsSwitch.java 2 C: > Users > 14848 > Documents > readings > J SeasonsSwitch.java > SeasonsSwitch > main(String[]) 7 import java.util.Scanner; 8 public class Seasons Switch { 0A7 9 PEGADGANG 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 PROBLEMS Run | Debug public static void main (String[] args) { Scanner sc = new Scanner(System.in); System.out.println(x: "Enter a date (String, int): "); String month = sc.next(); int day = sc.nextInt (); String season = ""; switch (month) { case "March": season=("Spring"); System.out.println( month+day + " falls under " + season); break; SeasonsSwitch.java - Visual Studio Code case "April": season=("Spring"); System.out.println( month + day + " falls under " break; case "May": OUTPUT DEBUG CONSOLE TERMINAL Type here to search + season); Septmber 11 invalid number PS C:\Users\14848> & 'C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot\bin\java.exe' '-cp' 'C:\Users\14848\AppData\Local\Temp\vscodesws_ 5718f\jdt_ws\jdt.1s-java-project\bin' 'SeasonsSwitch' Enter a date (String, int): September 67 September67 falls under Summer PS C:\Users\14848> HH | ? ! Launch Seasons IA XI Ln 15, Col 10 Spaces: 4 68F 08 UTF-8 CRLF I x tv ^ x Run: Seasons Run: Season... Run: Season... Run: Season... Run: Season... Run: Season... Run: Season... {} Java 4:50 PM 9/11/2022
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
According to a survey study conducted by Rossi (2013), the exchange rate predictability depends on: 1 sample period and model 2 the choice of predictor 3 forecast horizon and evaluation method 4 all...
-
Why is whitewash sometimes applied to the glass of florists' greenhouses in the summer?
-
The percent p of wood lost in cutting it into boards 1.5 in. thick due to the thickness t (in in.) of the saw blade is Find p if t = 0.4 in. That is, since p = f (t), find f(0.4). P = 100t t + 1.5
-
Identify the most appropriate approach and then design. Provide a rationale as to why this approach and design would be most appropriate. Develop a hypothetical research scenario that would...
-
Ron Williams recently took over as the controller of Johnson Brothers Manufacturing. Last month, the previous controller left the company with little notice and left the accounting records in...
-
Recall the definition of big-O: a function f(n) = O(g(n)) if c = R+, n = 1, Vn N1, (n no) f(n) c g(n) For the following pairs of functions, give a formal proof of each claim. a. [4 marks] If f(n) 17n...
-
One-year rates are expected to be 0.4%, 1.0%, 1.8%, 2.2%, and 2.1% over the next five years, respectively. If investors demand a 20 bp liquidity premium, what would you expect the interest rate to be...
-
Could you please provide a summary of the three waves of the feminist movement, delineating their key principles, goals, and historical contexts, while employing advanced language?
-
E-Games 4 U Corporation is evaluating some capital investments for the coming year. Since capital investments are a key factor for the firm's wealth creation, The board of directors has assigned you...
-
An engineer wants to have a rough idea about the potential revenue of a run-of-river hydropower plant before performing any detailed computations. There are no measurements of streamflow, but based...
-
Describe and contrast the difference between liberal politics and socialist economics.
-
13. Consider otherwise comparable 1 year and 2 year zero-coupon bonds. Both bonds have a face value of $1000. a. If newly issued 1 year bonds are selling for $957 today and newly issued 2 year bonds...
-
Set A The following is the monthly payroll of Andersen Company, owned by Donald Andersen. Employees are paid on the last day of each month. BA-1. JANUARY FICA Monthly Earnings YTD Earnings Employee...
-
Find the numerical value of each expression. (a) sech 0 (b) cosh -1 1
-
Mary paid $2,000 of state income taxes in 2012. The total sales tax she paid during 2012 was $5,500, which included $3,000 for the cost of a new car. How should Mary treat the taxes paid on her 2012...
-
On September 14, 2012, Jay purchased a passenger automobile that is used 75 percent in his accounting business. The automobile has a basis for depreciation purposes of $35,000, and Jay uses the...
-
Brian and Kim have a 12-year-old child, Stan. For 2012, Brian and Kim have taxable income of $52,000, and Stan has nonqualifying dividend income of $4,500 and investment expenses of $250. No election...
-
The deletion rules for enforcing referential integrity include both Delete. Cascade and Delete Restrict In general, what criteria should a DBA use in deciding whether to use a Delete: Cascade or...
-
What is metadata? if database administrators need to define metadata, what kind of language should they use (DDL or DML)? Why?
-
What is a relational database?
Study smarter with the SolutionInn App