Hey guys. Im in my first week of class for Java OOP. This is what my first assignment looks like

**1. Ask from the user: how many students take CompSci in summer, and store that number in a
variable.**

**2. Ask the user to input the name and mark of each student (marks are from 100), and store
names and marks in two separate arrays.**

For example
John 100
Kathy 86
Kevin 90
Colin 93

**3. Next, compute the average of the marks, and print it. Also find the minimum and the maximum
mark and print the name of the person who got the min. and max. mark among students.**

For example Avg is 86.55
Max is 100 (John)
Min is 86 (Kathy)

**4. Next, sort the list of students based on their marks from the maximum mark to the minimum
mark, and print in the output the sorted list.**

For example Marks in sorted order :
John 100
Colin 93
Kevin 90
Kathy 86

**5. Finally, print the total number of students who got :**

marks greater than 90
marks between 80 and 89
marks between 70 and 79
marks less than 70

-------------------

I really need some help with this. I would really appreciate if someone can show me how this should be done. I just need some thing to read to see how the code works.

Thanks you

Recommended Answers

All 2 Replies

what have you got so far, besides the assignment?

Well,doesn't seem like you can do this without an input stream.If you have been taught about Scanner class in the java.util package,then that should help you to accept input from the user.Maximum and Minimum finding functions are available in the Arrays Class in the java.util package.Refer to the Java's API Documentation for more information.While sorting,you need to sort the mark array and side-by-side sort the name array else,it will get out of sanity.And finally,printing them in the given ranges is the usage of if...else if statements

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.