Comparison and Development of Perl, PHP, JavaScript and Java

Verified

Added on  2019/10/18

|4
|1404
|244
Report
AI Summary
The third and final COMP284 assignment requires students to write a report comparing Perl, PHP, JavaScript, and Java. The report should identify three language constructs on which these languages differ syntactically, excluding conditional statements. Additionally, the student must describe what differentiates these scripting languages from Java. The assignment also requires students to develop a JavaScript program that simulates a simple game of chance. The program should be accessible via a URL and work without producing script errors.

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
JavaScript
main body start
Your task for the third and final COMP284 assignment consists of the
following parts:
1 Write a report comparing Perl, PHP, JavaScript and Java:
Identify three language constructs on which Perl, PHP, and
JavaScript pairwise differ syntactically (excluding the example
given below) and present these in tabular form. If you identify
more than three language constructs in your report, then the
marks awarded for the excess language constructs will be
discarded (starting with the lowest mark). Example:
Perl PHP
The syntax for conditional statements is if
(condition) { } elsif
(condition) { } else { }
The syntax for conditional s
(condition) { } e
(condition) { } e
Describe what differentiates the three scripting languages Perl,
PHP, JavaScript from a programming language like Java.
2 Your answers should be presented as a short report of most two pages
long (plus a cover sheet indicating your name, student id, and
departmental user name). Sources, including the lecture notes, must
be referenced. The list of references counts towards the length of the
report. Make sure that you use your own words. The report must be
submitted in PDF.
3 Develop a JavaScript program that provides the functionality stated in the
Requirements section below.
4 Make the system that you have created accessible and usable via the
URL http://cgi.csc.liv.ac.uk/~<your user
name>/game.html taking care that the access rights for the file
are neither too restrictive nor too permissive.
Part 1 is worth 25% (10/40) of the overall mark for this assignment. Parts 2
to 4 are together worth 75% (30/40) of the overall mark for this assignment.
Requirements
The program simulates a simple game of chance that proceeds in rounds.
Before the first round, the player enters the cost of playing one round,
called playCost in the following, and the number of rounds to play, called
noOfRounds. Both playCost and noOfRounds are integers greater or equal
to zero. If the player enters something that is not an integer greater or
equal to zero, for either playCost or noOfRounds, then an error is indicated

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
and the player is required to enter a new value (or values); this is repeated
until valid values for both playCost and noOfRounds have been entered.
The system also maintains a balance that is zero initially.
In each round of the game, the system displays three symbols, called A, B
and C in the following, where each symbol is equally likely to occur. The
player wins if all the symbols are the same (e.g., B B B is displayed) or all
three symbols are different (e.g., B A C is displayed), otherwise the player
has lost. After the three symbols have been displayed in a round, the
system indicates whether the player has won or lost.
An amount which is three times the cost of playing one round (i.e. 3 x
playCost) is won by the player if three symbols the same are displayed. An
amount of two times the cost of playing one round (i.e. 2 x playCost) is won
if the three symbols all different are displayed. In all other cases, nothing is
won. At the end of each round the system adds the amount won to the
balance and subtracts playCost from the balance.
In addition to the three symbols and an indication whether the player has
won or lost, at the end of the round the program shows the amount won in
that round and the balance. There must also be a way in which the player
initiates the next round of the game.
After all rounds have been played the system indicates the quotient of
balance and noOfRounds (remember, noOfRounds may be zero and this
case has to be handled appropriately).
Additional requirements and comments:
The optimal solution is independent of the number of symbols that are to
be displayed in a round as well as the range of letters that can be
used as symbols.
The visual design of the game does not need to use letters but can use
any symbols or images. Remember that if you use images, then they
must be your own or your use must be legal under copyright law. You
should also provide a reference for the source or sources of your
images in your design report.
JavaScript engines differ from browser to browser. You should make sure
that your system works in all commonly used browsers (e.g., Google
Chrome, Mozilla Firefox, Microsoft Internet Explorer 9 or higher) and
on all commonly used platforms (e.g., Linux derivatives and Microsoft
Windows).
Your JavaScript program should only depend on your own code.
JavaScript libraries/frameworks should not be used.
Your code should be properly commented. This includes pointing out
Document Page
which parts of your code have been developed with the help of on-
line sources or textbooks and references for these sources.
Submission
Submit the following files (as separate, individual files; not as part of an
archive file) via the departmental submission system at
https://sam.csc.liv.ac.uk/COMP/Submissions.pl?module=comp284
(COMP284-31: Re-sit: JavaScript):
a PDF file of your report on the comparison of Perl, PHP, JavaScript and
Java;
the HTML/CSS file or files, all JavaScript files, and all auxiliary files for
your JavaScript program.
Do not forget to also complete the third part of the assignment.
Deadline
The deadline for this assignment is
Tuesday, 16 August 2016, 17:00
Earlier submission is possible, but any submission after the deadline
attracts the standard lateness penalties. Please remember that a strict
interpretation of `lateness' is applied by the Department, that is, a
submission on Tuesday, 16 August 2016, 17:01 is considered to be a day
late (analogously for submissions that are delayed further).
Assessment
This assignment will address the following learning outcomes of the
module:
compare and contrast languages such as JavaScript, Perl and PHP with
other programming languages;
rapidly develop simple applications, both computer and web-based, using
an appropriate scripting language;
document and comment applications written using a scripting language.
This assignment will contribute 40% to the overall mark of COMP284.
Failure on this assignment may be compensated by higher marks on other
assignments for this module.
The report on the comparison of Perl, PHP, JavaScript and Java will be
marked separately. Comprehensiveness and quality of the report on the
comparison of Perl, PHP, JavaScript and Java will determine 25% (10/40)
of the mark for this assignment. The remaining 75% (30/40) will be
determined by the remaining tasks of this assignment and marks will be
awarded according to the following scheme:
The JavaScript program is accessible via the required URL and works
without producing script errors: 8
Document Page
Correctness and quality of the solution to the JavaScript programming
task (92 in total):
Quality of the interface design and works with all browers that were
tested: 15
Input/Output handling: 25
Correctness of computations: 30
Use of suitable functions and data structures for the computations:
10
Formatting, commenting, and quality of code: 12
Penalties:
If the report is not submitted as a PDF files, then 5 marks will be
subtracted from the mark for the assignment.
For every additional page that a report exceeds the specified page limit, 5
marks will be subtracted from the mark for the assignment.
1 out of 4
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]