Summer, 2018 9. What will be returned from the following method? public static i
ID: 3913017 • Letter: S
Question
Summer, 2018 9. What will be returned from the following method? public static int methodA(0 double a 8.5+9.5 return a 10. Use Scanner and switch. between 1 and 5. Evaluate the number and display the corresponding vowel: Write a program that prompts the user to enter an integer Vowel Integer 2 Match each term with the correct statement below. a. relational operator b. NOT operator c. Boolean values dual-alternative e. switch statement i. AND operator true and false ouble equal si o possible courses of action n the OR operator e to using a series of nested if statements T operator te the results of anyExplanation / Answer
Question 9 will give an error since implicit conversion is not possible from double to int
this occurs because on conversion from double to int data-loss can take place so, it raises an error.
Question 10
import java.util.Scanner;
public class Test{
public static void main(String []args){
Scanner sc = new Scanner(System.in); //scanner object for taking inputs
System.out.println("Enter a number between 1 to 5");
int choice=sc.nextInt(); //taking input from user
switch(choice){ //switch case
case 1 : System.out.println('a');
break;
case 2 : System.out.println('e');
break;
case 3 : System.out.println('i');
break;
case 4 : System.out.println('o');
break;
case 5 : System.out.println('u');
break;
default : System.out.println("Wrong input"); //executes when user inputs wrong data
}
}
}
Hope it Helped!!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.