Output of this in java?
String season = ""; int n = 0; switch (season) { case "Spring": n = 16; break; case "Summer": n = 17; break; case "Fall": n = 18; break; case "Winter": n = 19; break; default: n = 20; break; } System.out.println(n);
Output of this in java? String season = ""; int n = 0; switch (season) {...
Pick a switch statement from the reading. Put it into a main() Java program and make it work. Attach the .java file and copyAndPaste the output into the WriteSubmissionBox The switch Statement S1.51 Multiway if-else statements can become unwieldy when you must choose from among many possible courses of action. If the choice is based on the value of an integer or character expres- sion, the switch statement can make your code easier to read. The switch statement begins with...
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:...
20) What is the output of the following segment of C code: int avg(int n, int* a); int main () { int array[4]={1,0,6,9}; printf("%d", avg(4, array)+ 1); system("pause"); return 0; } int avg(int n, int* a) { int i, sum=0; for (i=0;i<n;i++) { sum+=a[i]; } return sum/n; } a) 16 b) 5 c) 4 d) 8 21) What is the output of the following segment of C code: int x = 2; int y = 3;...
public static void main(String[] args) { int option=0; while(option<8){ Scanner input=new Scanner(System.in); System.out.println("Welcome! Please enter your name"); String name=input.next(); Person user= new Person(name); System.out.println("Your id: "+user.getID()); System.out.println("Login successful"); System.out.println("------------------------------"); while(option!=7){ System.out.println("1.Create and host a new meeting"); System.out.println("2.Cancel a meeting"); System.out.println("3.Attend an existing meeting"); System.out.println("4.Leave a meeting"); System.out.println("5.Display my meetings"); System.out.println("6.Display meetings organized by me"); System.out.println("7.Logout"); System.out.println("8.Exit the app"); option=input.nextInt(); switch(option){ case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; case 6: break;...
Please show output in python 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...
JAVA I need a switch so that users can input one selection then another. These selections are for a simple calculator that uses random numbers 1. + 2. - 3. * 4./ 5. RNG. This has to be simple this is a beginners class. Here is what I have import java.util.Scanner; import java.util.Random; import java.util.*; public class You_Michael02Basic_Calculator { public static void main(String[] args) { // Generate random numbers int num1,num2; num1 =(int)(Math.random()*100+1);...
Output of this in Java? char c = 'B'; switch (c) { case 'A': c= 'K'; case 'B': c = 'E'; case 'C': c = 'Q'; case 'D': c = 'H'; default: c = 'M'; } System.out.println(c);
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...
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...
C++ ONLY Write a function, int flip(string a[], int n); It reverses the order of the elements of the array and returns n. The variable n will be greater than or equal to zero. Example: string array[6] = { "a", "b", "", "c", "d", "e" }; int q = flip(array, 4); // returns 4 // array now contains: "c" "" "b" "a" "d" "e" Write a function, int flip(string a[], int n); It reverses the order of the elements of...