LP002 Data Structures Sorting Student Records

代写LP002留学生作业、代做Data Structures作业、代写Java程序作业、代做Java编程作业
Homework 1 - Sorting Student Records
LP002 Data Structures
October 31, 2018
1 Introduction
You are asked to implement a tiny Java program to manage Student Records for our university. In
particular, your program should be able to read the score reports of students from a given file. More
specifically, your MSSR shall provide end users with efficient and effective sorting the given large
number of student records.
2 Specification
Your MSSR system shall provide users with searching and sorting on a large number of student score
records.
2.1 Read score records
The score report has the following format:
(a) The first line contains the number of records, says N (N ≥ 1).
(b) Each of the next N lines contains a comma separated list of student’s StudentID, Student
Name, Course Code and his/her obtained Score.
StudentID starting with ‘s’ occupies totally 11 characters.
Student Name is a varied string from 5 to 14 characters.
Course Code is a fixed 5-character string.
Score is an integer ranging from 0 to 100.
(c) You may assume there is no space before and after the comma delimiter and there is no trailing
space after each line of data.
(d) Note that you SHOULD NOT change the input data file format.
The following is an example of data file:
1
5
s1109853011,JackieChan,CS001,85
s0907451244,FranklinPapadias,MA002,65
s0308893477,MirandaLambert,HM467,35
s4045128481,SophiaPam,CM604,75
s0812340023,PhilipsChiu,CS001,71
As shown in the above example, there are 5 students in this score report.
2.2 Store records
After reading the score reports successfully, your program should be able to store student scores. In
particular, your program should store the course information as follows:
Student:
Student ID
Student Name
Score
Code Code
Note:
You need to design a class to sore the student record.
You should specify enough space for each field defined in your class (data structure).
2.3 Sorting
You are required to display the report according to StudentID, student name, course code
and the score in either an ascending order or a descending order. For example as shown as follows,
the students are listed in ascending order lexicographically according to their StudentID.
output:
s0308893477,MirandaLambert,HM467,35
s0812340023,PhilipsChiu,CS001,71
s0907451244,FranklinPapadias,MA002,65
s1109853011,JackieChan,CS001,85
s4045128481,SophiaPam,CM604,75
Note:
To specify which field to be sorted and the sorting ways (ascending or descending), you can let
user input it as a parameter.
An example input for specifying the sorting parameter:
2
Please choose the sorting field: 1
(1) StudentID; (2) Student Name; (3) Course Code; (4) Score
Please choose the sorting ways: A
(A)scending order; (D)escending order
2.4 Performance
Your system shall be efficient in both searching and sorting. In particular, the running time for a single
query of your system shall be less than 20 seconds with the number of records N is less than 100,000.
Every extra second leads to subtracting one point in your score (note that the time for reading
records will not be counted in the performance). Therefore, please try to call faster algorithms (e.g.
quick sort, merge sort and binary search trees, etc.) to implement your system.
3 Submission
Your Submission
1. A soft copy of your source program including all the components.
2. readme file (readme.txt) which contains:
(a) file list
(b) file description
(c) methods of compilation
(d) method of execution
(e) known bugs of your system
A good example:
/ Assignment 1
Name : Alex Fung
Student ID: 1009853X I011 YYYY
Section:LP002
email: [email protected]
Description:
This file contains the ThreeSum class, which counts
the number of tuples equal to 0.
/
public class ThreeSum
{
/Description:
Brute force method to compute the the number of
3
tuples equal to 0 by checking condition:
a[i] + a[j] + a[k] == 0
Parameters:
a: the array
Return:
count: the number satisfying the condition
/
public static int count(int[] a)
{
int N = a.length; // The size of array
int count = 0; // the result
for (int i = 0; i < N; i++)
for (int j = i+1; j < N; j++)
for (int k = j+1; k < N; k++)
if (a[i] + a[j] + a[k] == 0)
count++;
return count;
}
/ A testing client reads an array from standard input
and prints the number of tuples equal to zero.
/
public static void main(String[] args)
{
int[] a = StdArrayIO.readInt1D();
StdOut.println(count(a));
}
}

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱:[email protected] 

微信:codinghelp

猜你喜欢

转载自www.cnblogs.com/okjavanewpython/p/10013207.html