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 any
0 0
Add a comment Improve this question Transcribed image text
Answer #1

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!!

Add a comment
Know the answer?
Add Answer to:
Summer, 2018 9. What will be returned from the following method? public static int methodA(0 double...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT