Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA ASSIGNMENT PLEASE HELP! Programming: ArrayLists The class Student, shown below, which holds name, major and credits earned for a student. Using the built-in Java
JAVA ASSIGNMENT PLEASE HELP!
Programming: ArrayLists
The class Student, shown below, which holds name, major and credits earned for a student.
Using the built-in Java ArrayList
Write a method
public static double averageCreditsForMajor(ArrayList
which returns the average creditsEarned for all the students in the given major from the list.
STUDENT CLASS:
public class Student { private String name; private String major; private double creditsEarned; public String getName() { return name; } public void setName(String name) { this.name = name;} public String getMajor() { return major; } public void setMajor(String major) { this.major = major; } public double getCreditsEarned() { return creditsEarned; } public void setCreditsEarned(double credits) { credits = creditsEarned; } public Student(String nam, String maj, double credits) { name = nam; major = maj; creditsEarned= credits; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started