Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java, help me please Write a call to the method countAs so that the println stat

ID: 3917700 • Letter: J

Question

Java, help me please

Write a call to the method countAs so that the println statement will not generate a syntax error.

import java.util.Scanner;
public class FinalTest {

public static void main (String args[]) {
Scanner keyboard = new Scanner(System.in);
int numberAs, scores[] = {90, 85, 95};
String incomplete = keyboard.nextLine();
// call to area here
System.out.println("Number of As is " + numberAs);
}
public static int countAs(int exam[], String gType) {
int num = exam[0];
for (int i = 1; i < exam.length; i++)
if (exam[i] >= 90)
num++;
if gType != "i";
return num;
else
return 0;
}

}

Explanation / Answer

import java.util.Scanner; public class FinalTest { public static void main (String args[]) { Scanner keyboard = new Scanner(System.in); int numberAs, scores[] = {90, 85, 95}; String incomplete = keyboard.nextLine(); // call to area here System.out.println("Number of As is " + countAs(scores, incomplete)); } public static int countAs(int exam[], String gType) { int num = 0; for (int i = 0; i = 90) num++; if (!gType.equals("i")) return num; else return 0; } }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote