Graduate Diploma
Level 7
(Information Technology Strand)
STD511 Java Programming
NQF Level 5, 10 credits
Assignment
(Worth 30% of final Mark)
40 Marks
Instructions and guidelines for the assignment:
1. Submission date and time: ___________________________________.
2. The completed assignment must be handed to the lecturer at the beginning
of the class on the due date.
3. Submit a print and bonded copy of your report along with the electronic copy
of all work. The lecturer will inform you how to submit the soft copy.
4. Warning: All media must be virus free! Media containing virus or media
that cannot be run directly will result in a FAIL grade.
5. You must read and understand Aspire2’s policy on ‘Academic Dishonesty
and Plagiarism’. Assignments completed using unfair means or plagiarised will
eceive a FAIL grade.
6. The report must have a title page with your name, class and id number clearly
printed.
7. Start working on the assignment as soon as it has been handed out in the
class. Working on the assignment right from day one will ensure that it is
completed on time.
8. Work through each task, making copies of the source codes, diagrams and
output produced as you complete them as they will be required as part of your
submission.
9. Use the right naming and indentation style. Use comments to document each
class and method.
10. Assignments will be judged on the basis of completeness, co
ectness and
clearness.
Learning Outcome Targeted:
Create, test, and document computer programs containing a variety of
algorithms using Java.
Demonstrate understanding of the principles and fundamentals of object
oriented programming using Java
Develop small software development products of moderate complexity
using an object oriented development framework.
Task 1 (10 Marks)
Suppose you save $100 each month into a savings account with the annual
interest rate 5%. So, the monthly interest rate is 0.05 / 12 = XXXXXXXXXXAfter the
first month, the value in the account becomes
XXXXXXXXXX100 * XXXXXXXXXX) = XXXXXXXXXX
After the second month, the value in the account becomes
XXXXXXXXXX XXXXXXXXXX) * XXXXXXXXXX) = XXXXXXXXXX
After the third month, the value in the account becomes
XXXXXXXXXX XXXXXXXXXX) * XXXXXXXXXX) = XXXXXXXXXX
and so on.
Your tasks:
1. Formulate an algorithm to solve the problem, and document the steps you
will take in solving the problem using either
a. pseudo-code, or
. a flow chart
2. Write a Java program that prompts the user to enter an amount (e.g., 100),
the annual interest rate (e.g., 5), and the number of months (e.g., 6) and
displays the amount in the savings account after the given month. You have
to create a class for saving account with appropriate properties and
methods.
3. Embed comments in your program to explain the operations.
Task 2 (10 Marks)
A department store has asked you to develop a program that will determine
whether a customer has exceeded the credit limit on their account.
For each customer, the following information is available:
a. Account Number
. Balance at the beginning of the month
c. Total of all items charged by this customer this month
d. Total of all credits applied to this customer’s account this month
e. Allowed credit limit
Your program should input all these facts as integers, calculate the new balance
(= beginning balance + charges – credits) and determine whether the new
alance exceeds the customer’s credit limit. For those customers whose credit
limit is exceeded only, the program should display the customer’s account
number, credit limit, new balance and the message “Credit Limit Exceeded”.
Your tasks:
1. Formulate an algorithm to solve the problem, and document the steps you
will take in solving the problem using either
a. pseudo-code, or
. a flow chart
2. Write a Java program which follows your pseudo-code or flow chart as
closely as possible. You have to create class for an account object and with
the appropriate properties and methods.
3. Embed comments in your program to explain the operations.
Task 3 (20 Marks)
Write a Java program to read the name and mark of 3 courses for a number of
students (not more than 20). Create a class for a student with appropriate
properties and methods. The program calculates the average of each student
and show his/her grade:
The grade is calculated as follows:
Average Grade
90-100 A
80-89 B
70-79 C
60-69 D
0-59 F
The program then shows the following menu and asks the user for his choice:
1: Print the entire list
2: Sort and print the list alphabetically
3: Sort and print the list in descending order based on the average.
4: Ask the user to enter an average and search for the student who has that
average
5: Find the student who has the minimum average
6: Print the grade distribution
0: Exit
Enter your choice?
Each time the user chooses an option the program shows the required output
and the redisplays the menu again until the user selects 0.
The following has to be used:
Selection sort for option 2.
Insertion sort for option 3.
Binary search for option 4.
Sequential search for option 5.
Program Output Example:
Enter number of students? 3
Enter name and 3 marks for student 1? John XXXXXXXXXX
Enter name and 3 marks for student 2? Alex XXXXXXXXXX
Enter name and 3 marks for student 3? Sara XXXXXXXXXX
Student Average Grade
John XXXXXXXXXX XXXXXXXXXXB
Alex XXXXXXXXXX XXXXXXXXXXD
Sara XXXXXXXXXX XXXXXXXXXXC
============================================
1: Print the entire list
2: Sort and print the list alphabetically
3: Sort and print the list in descending order based on the average.
4: Find the student average
5: Find the student who has the minimum average
6: Print the grade distribution
0: Exit
============================================
Enter your choice? 1
Student Mark1 Mark 2 Mark3 Average Grade
John XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXB
Alex XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXD
Sara XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXC
===========================================
1: Print the entire list
2: Sort and print the list alphabetically
3: Sort and print the list in descending order based on the average.
4: Find the student average
5: Find the student who has the minimum average
6: Print the grade distribution
0: Exit
===========================================
Enter your choice? 2
Student Mark1 Mark 2 Mark3 Average Grade
Alex XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXD
John XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXB
Sara XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXC
======================================
1: Print the entire