Home / Expert Answers / Accounting / can-some-one-know-how-solve-java-programming-assignment-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-pa204

(Solved): Can some one Know how solve Java Programming Assignment?             ...



Can some one Know how solve Java Programming Assignment?

 

1. Answer the following questions:
i. Which of the following method heading are valid? If they are invalid, explain why.
a. p

 

 

 

 

2. Write a value-returning method, isVowel that returns the value true if a given character is a
vowel, and otherwise returns

 

 

 

3. Write a value-returning method, countChar, that returns the number of occurrences of a
character in a string. The characte

1. Answer the following questions: i. Which of the following method heading are valid? If they are invalid, explain why. a. public static secret(int a, int b) (invalid) b. public static int method c. public static char firstMethod (int a, double x) d. public static double larger (double a, b) ii. Consider the following statements: double num1 = 5.0, num2 = 6.0, num3 = 3.0; int int1 = 4, int2 = 7, int3 = 8; | and the method heading: public static double cube (double a, double b, double c) Which of the following statements are valid? If they are invalid explain why. a 11 a. value = cube (numi, 15.0, num3); b. System.out.println (cube (numi, num3, num2)); c. System.out.println (cube (6.0, 8.0, 10.5)); d. System.out.println(num1 + " + num3); e. System.out.println (cube (numi, num3)); f. value = cube (numi, int2, num3); g. value = cube (7, 8, 9); iii. Consider the following method: public static int secret (int one) { int i; int prod = 1; for (i 1; i <= 3; i++) prod = prod one ; return prod; } = What is the output of the following Java statements? a. System.out.println (secret (5)); b. System.out.println (2 * secret (6)); c. System.out.println(secret (10/4 + 2)); 2. Write a value-returning method, isVowel that returns the value true if a given character is a vowel, and otherwise returns false. Then write a program that prompts the user to input a sequence of characters and outputs the number of vowels. 3. Write a value-returning method, countChar, that returns the number of occurrences of a character in a string. The character should be counted in the string if it occurs in lowercase or uppercase. Then write a program that prompts the user to input a character and a sentence as a String and outputs the number of occurrences of the character. Example run: run: Enter a character: w Enter a sentence: Welcome to writing center to learn how to write w occurs 4 times. BUILD SUCCESSFUL (total time: 0 seconds)


We have an Answer from Expert

View Expert Answer

Expert Answer


1. i. a. Invalid - No return type. b. Invalid - No brackets. c. Valid d. Invalid - no data type of variable b is mentioned. ii. a. Invalid - variable value doesn't have any data type. The data type should be double as cube method is returning double
We have an Answer from Expert

Buy This Answer $5

Place Order