Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

More homework help wweh


lollicat
 Share

Recommended Posts

Hello I am here with more help on my homework lol sorry guys for all this bothering

bUT

Basically, [this](https://sites.google.com/site/hdjcomputerprogramming/home/unit-7/more-test-scores) is the assignment.

Here is my code:

```

import java.util.Scanner;

public class moreScores

{

public moreScores(String studentName)

{

String name = studentName;

}

public static void main(String[] args)

{

int numStudents, numTests;

String name = "", stud;

double score, average = 0;

Scanner scan = new Scanner(System.in);

Scanner scanLine = new Scanner(System.in);

// im not ready for this

// help me

// i dont want to do this program

System.out.print("\fHow many students: ");

numStudents = scan.nextInt();

System.out.print("How many tests: ");

numTests = scan.nextInt();

moreScores[] students = new moreScores[numStudents];

//what am i doing with my life

for (int i=0; i
```
Link to comment
Share on other sites

> When you turn this in, I highly recommend removing those comments.
>
> Also, I don't miss high school one bit.

I don't know Java, but if it's anything like C++/C# then you should take a look at the conditions of your loops, namely concerning numStudents and numTests.
Link to comment
Share on other sites

I had this same assignment in like week 2 or 3 of my Java class at my last college. We had to keep it looping and let you remove students later and other things like that. I deleted all my old college work when I left that school though lol.

Your loops where all messed up and the way you where storing students and scores wasn't a good way to go about it…

I know I should just explain how to fix it, but I'm bad at explaining code and will probably just make it more confusing so here is a decent way of how to do this (still probably could be better).

```

import java.util.Scanner;

public class moreScores

{

public static void main(String[] args)

{

int numStudents, numTests;

Scanner scan = new Scanner(System.in);

Scanner scanLine = new Scanner(System.in);

System.out.print("\fHow many students: ");

numStudents = scan.nextInt();

Student[] students = new Student[numStudents];

System.out.print("How many tests: ");

numTests = scan.nextInt();

// Loop through and get all students names

for (int i=0; i
```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...