QuestionQuestion

Using the following arrays:      
int []grades = {60, 72, 78, 95, 88, 82, 60, 97, 90, 85, 78, 75, 89, 53, 68, 83, 88, 75, 63, 94};
String []gender = {"M", "M", "F", "F", "M", "F", "F", "M", "M", "F", "F", "M", "F", "F", "M", "F", "F", "M", "M", "F"};
String []major = {"Math", "Math", "Physics", "Art", "Art", "Art", "Science", "Science", "Physics", "Art", "Math", "Math", "Math", "Science", "Science", "Physics", "Art", "Math", "Math", "Math"};
Store the three arrays in the main method. Write methods called method1, method2 and method3 to compute:
• Number of student’s in Math major.
• Total number of males in Math major.
• Total number of males in Math major who got a grade above 90 .
Return the values from the three methods back into the main methods and print from within.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

public class StudentsGrades {

public static int method1(String[] arr) {
int count = 0;
for(int i = 0; i < arr.length; i++) {
if(arr[i].equals("Math"))
count++;
}
return count;
}

public static int method2(String[] arr1, String[] arr2) {
int count = 0;
for(int i = 0; i < arr1.length; i++) {
if(arr1[i].equals("Math") && arr2[i].equals("M"))
count++;
}
return count;
}...

By purchasing this solution you'll be able to access the following files:
Solution.java.

$8.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats