辅导COSC2531-Assignment 3解析Java编程
- 首页 >> Java编程School of Science
COSC2531 Programming Fundamentals
Assignment 3
Assessment Type: Individual assignment; no group work. Submit online via Canvas → Assignments → Assignment 3.
Marks awarded for meeting requirements as closely as possible.
Clarifications/updates may be made via announcements/relevant discussion forums.
Due date: end of Week 14; The deadline will not change.
Please check Canvas → Assignments → Assignment 3 for the most up to date information.
As this is a major assignment, a university standard late penalty of 10% per each working day applies for up to 5
working days late, unless special consideration has been granted.
Weighting: 30 marks out of 100
1. Overview
The main objective of this assignment is to familiarize you with program design and implementation
for solving a non-trivial problem. You are to solve the problem by designing a number of code
snippets, methods, classes and associating them towards a common goal. If you have questions,
ask via the relevant Canvas discussion forums in a general manner.
2. Assessment Criteria
This assessment will determine your ability to:
1. Follow coding, convention and behavioral requirements provided in this document and in the
lessons.
2. Independently solve a problem by using programming concepts taught in this course.
3. Write and debug Java code independently.
4. Document code.
5. Ability to provide references where due.
6. Meeting deadlines.
7. Create a program by recalling concepts taught in class, understanding and applying concepts
relevant to solution, analysing components of the problem, evaluating different approaches.
3. Learning Outcomes
This assessment is relevant to the following Learning Outcomes:
1. Analyse computing problems.
2. Devise suitable algorithmic solutions and code these algorithmic solutions in JAVA.
3. Develop maintainable and reusable solutions using the modular or object oriented paradigm.
,
Page 2 of 5
4. Assessment details
MySchool is a Java application for schools. It reads data from files. IMPORTANT: you should
change data in these files to verify your program. We will use different files during marking.
Section 1: PASS Level
At this level, your program can read from a file specified in command line and store student scores in
a 2D integer array. You may define methods wherever appropriate to support the functionalities.
scores.txt
34 C081 C082 C083 C084
S2023 99 75 85 62
S2025 -1 92 67 52
S1909 100 83 45 -1
The file stores data as a text table shown above. Data fields are separated by spaces and new lines.
The first row contains course IDs and the first column contains student IDs. The first field in the data,
the top left corner, shows the number of rows and the number of columns in one integer. For
example ‘34’, the first digit 3 means there are 3 students in this table. The second digit 4 means
there are 4 courses. You can assume that the total number of courses will never be more than 9.
The table stores every student’s final results in those courses. Results are all integers. A result ‘-1’
means not enrolled in that course. A ‘0’ means the student did enrol but failed to receive any mark.
Your program can find the student with the highest average score and display on the command line:
> java MySchool scores.txt
> The top student is S2023 with an average 80
Section 2: CREDIT Level --- You must ONLY attempt this level after you complete the PASS level
Your program can read one more file which stores the information of courses offered by the school.
Info includes course ID, course title and credit points. You can assume all courses of the school
appear in this file and in the first file (student results file). There is no duplicate or redundant courses.
courses.txt
C081 Mathematics 12
C082 Science 12
C083 English 24
C084 Technologies 6
At this level your program can produce a text file named as course_report.txt.
> java MySchool scores.txt courses.txt
> The top student is S2023 with an average 80
> courses_report.txt generated!
,
Page 3 of 5
Given the above courses.txt, course_report.txt should look like below. The fourth column is
the number of enrolled students. The fifth column is the average score of each course.
C081 Mathematics 12 2 99
C082 Science 12 3 83
C083 English 24 3 65
C084 Technologies 6 2 57
Section 3: DI Level --- You must ONLY attempt this level after you complete the CREDIT level
A this level, your program can read one more file from command line. That file stores information
about students, that includes student ID, name (no space between first name and last name, but an
underscore) and age. You can assume all students appear in this file as well as in the first file
(student results file). There is no duplicate records or empty records.
students.txt
S2023 Sue_Vaneer 14
S2025 Robin_Smith 13
S1909 Barry_Banks 15
At this level your program can produce a text file report named as student_report.txt.
> java MySchool scores.txt courses.txt students.txt
> The top student is S2023 with an average 80
> course_report.txt generated!
> student_report.txt generated!
Given the above students.txt, student_report.txt should look like below. The fourth
column is the number of courses that student enrolled im. The fifth column is the average GPA. A
course result of 80+ receives 4 GPA points. A result of 70-79 receives 3 points. A result in between
60-69 is 2 points. 50-59 gets 1 points. Under 50 has 0 points. For example Sue Vaneer has 2 HD, 1
DI and 1 CR. So her GPA is ( 4 x 2 + 3 + 2 ) / 4 = 3.25.
S2023 Sue_Vaneer 14 4 3.25
S2025 Robin_Smith 13 3 2.33
S1909 Barry_Banks 15 3 2.66
At this level, your program can handle some variations in the files.
(1) characters in sources.txt will be treated as -1.
(2) decimal numbers will be treated as integers, ignoring the decimal part, e.g 99.5 -> 99
(3) The order of lines in both students.txt and courses.txt does not matter. (You can
assume that the order of columns does not change.)
scores.txt students.txt
34 C081 C082 C083 C084 S1909 Barry_Banks 15
S2023 99.5 75 85 62 S2025 Robin_Smith 13
S2025 x 92 67 52 S2023 Sue_Vaneer 14
S1909 100 83.2 45 abc
[Hint] You may find exception useful.
,
Page 4 of 5
Section 4: HD Level --- You must ONLY attempt this level after you complete the DI level
A this level, your program achieves the above requirements in OO style with at least three classes,
School
, Student and Course. Design the appropriate instance variables, constructor(s) and
methods for these classes. Class related info should be encapsulated inside of these classes.
In addition, student_report.txt generated at this level is more advanced, taking credit points of
each course into consideration. See below. The fourth column is now the total credit points that the
student has completed. For example Sue Vaneer, she has done all four courses, so she earned 12 +
12 + 24 + 6 = 54 credit points. The fifth column is the adjusted GPA. So that for Sue is (4 x 12 + 3 x
12 + 4 x 24 + 2 x 6 ) / 54 = 3.55, which is more accurate than that in the DI level.
S2023 Sue_Vaneer 14 54 3.55
S2025 Robin_Smith 13 42 2.42
S1909 Barry_Banks 15 48 2.0
Section 5: Miscellaneous
To verify the calculations, you can import the files, especial the provided test files, into a spreadsheet
tool, e.g. Excel, Google Spreadsheet, Numbers, which can easily compute average, max etc.
You program may have no interaction with users during execution. Simply run the code, read the
files, display output and/or generate file(s).
You can assume user always type file names in the right order in command line, e.g. score file first,
then course file, then student file. However it is possible that file is missing or cannot be found.
Your program should quite gracefully in these circumstances.
5. Referencing guidelines
What: This is an individual assignment and all submitted contents must be your own. If you have
used sources of information other than the contents directly under Canvas→Modules, you must give
acknowledge the sources and give references using IEEE referencing style.
Where: Add a code comment near the work to be referenced and include the reference in the IEEE
style.
How: To generate a valid IEEE style reference, please use the citethisforme tool if unfamiliar with this
style. Add the detailed reference before any relevant code (within code comments).
6. Submission format
Submit one file ProgFunAssignment3.zip, which is the zipped file of all your java file, via
Canvas→Assignments→Assignment 3. It is the responsibility of the student to correctly submit their
files. Please verify that your submission is correctly submitted by downloading what you have
submitted to see if the files include the correct contents.
1. Your final code submission should be clean, neat, and well-formatted (e.g., consistent
indentations) and abide by the formatting guidelines.
2. Identifiers should be named properly and camel case e.g. UsedCar (class) and carPrice
(variable). [Google “camel case”]
,
Page 5 of 5
3. You must include adequate meaningful code-level comments in your program.
4. IMPORTANT: your code should be able to compile and run under command-line.
7. Academic integrity and plagiarism (standard warning)
Academic integrity is about honest presentation of your academic work. It means acknowledging the
work of others while developing your own insights, knowledge and ideas. You should take extreme
care that you have:
• Acknowledged words, data, diagrams, models, frameworks and/or ideas of others you have
quoted (i.e. directly copied), summarised, paraphrased, discussed or mentioned in your
assessment through the appropriate referencing methods,
• Provided a reference list of the publication details so your reader can locate the source if
necessary. This includes material taken from Internet sites.
If you do not acknowledge the sources of your material, you may be accused of plagiarism because
you have passed off the work and ideas of another person without appropriate referencing, as if they
were your own.
RMIT University treats plagiarism as a very serious offence constituting misconduct. Plagiarism
covers a variety of inappropriate behaviours, including:
• Failure to properly document a source
• Copyright material from the internet or databases
• Collusion between students
For further information on our policies and procedures, please refer to the University website.
8. Assessment declaration
When you submit work electronically, you agree to the assessment declaration.
Code must be compiled under command line with no error,
> javac MySchool.java
and runnable under command line
> java MySchool scores.txt courses.txt students.txt
Submission failed to compile would receive heavy mark deduction.
Rubric
Assessment Task Marks
PASS Level 15 marks
CREDIT Level 3 marks
DI Level 3 marks
HD Level 6.5 marks
Others
Code quality and style; proper use of
methods arguments; good comments