Assignment Java Prs
Assignment Java Prs
Assignment Java Prs
This is an individual Assignment. You are not permitted to work as a group when writing this
assignment.
Copying, Plagiarism: Plagiarism is the submission of somebody else’s work in a manner that gives
the impression that the work is your own. The Department of Computer Science and Information
Technology (CSIT) treats plagiarism very seriously. When it is detected, penalties are strictly
imposed. Students are referred to the CSIT Handbook and policy documents with regard to plagiarism
and assignment return, and also to the section of ‘Academic Integrity’ on the subject learning guide.
No extensions will be given: Penalties are applied to late assignments (5% of total assignment mark
given is deducted per day, accepted up to 5 days after the due date only). If there are circumstances
that prevent the assignment being submitted on time, an application for special consideration may be
made. See Student Handbook for details. Note that delays caused by computer downtime cannot be
accepted as a valid reason for a late submission without penalty. Students must plan their work to
allow for both scheduled and unscheduled downtime.
SUBMISSION GUIDELINES:
Task 1 should be saved to a file named task1.txt using the SPOOL command.
Task 2 should be saved to a file named task2.txt using the SPOOL command.
Task 3 should be saved to a file named task3.txt using the SPOOL command.
Note: an example of using the SPOOL command is given in the lab book. In the SPOOL file, you need
to provide the query/procedure/function/trigger execution and the sample output. For the trigger, you
need to show a sample test that demonstrates the successful execution of the trigger.
All the tasks above are to be submitted in hard-copy format to the relevant submission box on
the first floor of the Beth Gleeson Building by 10.00am Wednesday, 24 May 2017. The same
tasks above are also required to be submitted online via the Assignment Submission on the LMS
by 10.00am Wednesday, 24 May 2017.
SUBMISSION CHECKLIST:
NOTE: No built-in ORACLE column numbering (such as ROWNUM) or other Oracle ranking
facilities (such as RANK) can be used here.
Implement the following tasks using ORACLE SQL*Plus.
Download the file SMatchSchema.sql from the LMS site and run it on ORACLE SQL*Plus. This
file contains all the CREATE and INSERT statements you will need for this assignment.
NOTE: YOU DO NOT NEED TO INSERT MORE DATA INTO THE TABLES.
Using the tables provided above, provide SQL statements for the following queries.
Provide the implementation of the following stored procedures and function. For submission, please
include both the PL/SQL code and an execute procedure/SQL statement to demonstrate the
functionality.
a. Write a stored procedure that takes an industry ID as an input and lists down the representing
trade union and all the registered businesses for that industry. The output should show the
trade union title in one line and all the businesses' ABN and business name in different lines.
b. Given the amount of overdue fine to be $20 a day. Write a stored function that takes as input a
client ID and returns the total fine based on the difference between the total days of rent and
maximum allowed rent duration of an equipment. Different values of fine should be generated
for a particular client if the function is executed on different dates.
c. Write a stored procedure that prints the total cost for equipment hire given a particular client
ID along with the total fine that the client owes to ServiceMatch. Use the stored function in
question b to calculate the fine amount. Also, assume it costs $150 a day to hire an equipment.
Provide the implementation of the following triggers. For submission, please include both the PL/SQL
code and an insert statement to demonstrate the trigger functionality.
a. A Trigger that will restrict a client from giving a review without a job reference or for a job
that is not assigned to any business yet.
b. Over the time, the number of created jobs in the ServiceMatch database can grow to a size
beyond maintenance. Due to this reason ServiceMatch deletes some of the old job from the
job table, but still keeps some information about those jobs in a backup table called
DeletedJobs. The information includes the job ID, the title of the job industry, the suburb
postcode of the job and the day on which the job was deleted. Write a trigger that will insert
these information on the backup table before the job is deleted.
N.B: please make sure that the backup table is created first. Also, use a database sequence
object to populate the primary keys for the backup table as ServiceMatch does not want JobID
to be the primary key for the backup table.