I need help with my assignment


This is the Assignment my instructor gave me.

Design and create a menu-driven program which allows a user to enter at most 50 students’ scores for a subject and displays variety of information based on the user selection.
The minimum requirements of this program are as follow:

  • Be able to display menu which contains at least 5 alternatives. - Be able to accept student name and total score.

  • Be able to display a score of a particular student. (search score by using student’s name as a key)

  • Be able to compute and display mean, median and mode of the whole scores.

  • Be able to list all student names who get score higher than the mean(average).

  • Contains at least 4 methods/functions.
    <Below this line, add a link to the EXACT exercise that you are stuck at.>
    I made it able to take the number of the students and their scores, made it print out the lists of students and their scores and made it ask me to put in the name I wanna see the score.
    I already create methods for Mean median and mode. but I cannot make it display without making error, and I cannot make it print out the students list who get score higher than the mean.

The deadline is tomorrow and I really need help, I cannot figure it out.
Please help. TT

<In what way does your code behave incorrectly? Include ALL error messages.>

[spoiler] ```

import java.util.Scanner;

public class SequentialSearch {
public static int seqSearch(String name, String key) {
int met = -1;
for (int i = 0; i < name.length; i++)
if (name[i].equals(key)) {
met = i;
return met;

public static void displayList(String[] name, double[] score) {
	System.out.println("Name  Score");
	for (int i = 0; i < name.length; i++) {
		System.out.println(name[i] + "\t" + score[i]);

public static double mean(double[] m) {
	double sum = 0;
	for (int i = 0; i < m.length; i++) {
		sum += m[i];
	return sum / m.length;

public static double median(double[] m) {
	int middle = m.length / 2;
	if (m.length % 2 == 1) {
		return m[middle];
	} else {
		return (m[middle - 1] + m[middle]) / 2.0;

public static int mode(int a[]) {
	int maxValue = 0, maxCount = 0;

	for (int i = 0; i < a.length; ++i) {
		int count = 0;
		for (int j = 0; j < a.length; ++j) {
			if (a[j] == a[i])
		if (count > maxCount) {
			maxCount = count;
			maxValue = a[i];

	return maxValue;

public static void main(String[] args) {
	Scanner in = new Scanner(System.in);
	System.out.print("How many student in the class?: ");
	int n = in.nextInt();
	String[] stName = new String[n];
	double[] stScore = new double[n];
	String temp = in.nextLine();
	for (int i = 0; i < n; i++) {
		System.out.print("Name: ");
		stName[i] = in.nextLine();
		System.out.print("Score: ");
		stScore[i] = in.nextDouble();
		temp = in.nextLine();
	displayList(stName, stScore);
	System.out.print("Enter the name of a student you want to know his score==> ");
	String sName = in.nextLine();
	int index = seqSearch(stName, sName);
	if (index != -1) {
		System.out.println(stName[index] + " is met at the index#" + index + 1);
	} else {
		System.out.println("Not found :(.");



<do not remove the three backticks above>

We should mention that posting of homework assignments on this site is actually in breach of copyright protection in force on the learning material you are using, which is licensed to your school, and not for public consumption. This puts us in a difficult position as learning institutions routinely ask us to take down this sort of posting. We cannot help you. Only your teacher and classmates can, and of course, you. You can help yourself big time by reading. This assignment wouldn’t have been given to you if you were not sufficiently prepared to challenge it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.