Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java - Student Scores Application (no user input)

brooklyn2fla
brooklyn2fla 


Example: Welcome to the Student Scores Application. Enter number of students to enter: 4 Last name: Steelman First name: Andrea score: 95 Last name: Murach First name: Joel score: 92 Last name: Lowe First name: Doug score: 82 Last name: Murach First name: Mike score: 93 Lowe, Doug: 62 BELOW AVERAGE Murach, Joel: 92 Murach, Mike: 93 Steelman, Andrea: 95 Class Average: 85.5 Press any key to continue . . . Operation • This application accepts the last name, first name, and score for one or more students and stores the results in an array. Then, it prints the students and their scores in alphabetical order by last name. The application should display the class average at the end of the students information. It should also display a message: "Below Average" after each student whose grade is more than 10 points below the class average. Specifications • The program should implement a class named Student that stores the last name, first name, and score for each student. This class should implement the IComparable interface so the students can be sorted by name. If two students have the same last name, the first name should be used to determine the final sort order. • The program should use an array to store the Student objects. Then, it should sort the array prior to printing the student list. • Validate the input so the user can enter only a positive integer for the number of students, the last or first name can’t be an empty string, and the score is an integer from 0 to 100. Attachments Tags Clarifications

Answers

Java - Student Scores Application (no user input) - Solution

dickersonka
dickersonka 



Attached is the solution to the Java - Student Scores Application (no user input) assignment. This reads only from the text file with no user input. If you need any changes, please let us know.

Also attached is a single file implementation.
Attachments
StudentScores.zip (2 K) Download
Preview
Student student = new Student(); //set properties student.setLastName(studentLastName); student.setFirstName(studentFirstName); student.setScore(score); //add to array students[numStudents] = student; //add score to total totalScore += student.getScore(); //increment counter numStudents++; } System.out.println(); System.out.println("---Calculating and Sorting---"); //Calculate average

Preview
private double score; public Student(){ } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getFirstName() { return firstName; }

Preview
Geralyn 15 Genest Teodoro 32 Ogles Loreen 14 Read Livia 32 Empey Wava 27 Defibaugh So 31 Bruning Diana 32 Seefeldt Lynsey 56 Costales Melvin 60 Speicher Roseann 53 Leatham Jenee 2 Manhart Denna 46 Maurer Audrea 40 Lindsey Rosaline 4 Belden Annis 86 Belew Broderick 3 Beltran Voncile 10

ReadStudentDataSingleFile.java (3 K) Download Preview
//display average System.out.println(); System.out.println("Class Average: " + df.format(average)); } class Student implements Comparable{ private String lastName; private String firstName; private double score; public Student(){ } public String getLastName() { return lastName; } public

Screenshots
Purchase Answer