javascript代写: BCSE 101 Assignment Two

Department of Computing

Bachelor of Information and Communication Technologies Graduate Diploma of Information and Communication Technologies

BCSE 101 Software Engineering

Assignment Two Programming Assignment 1

Semester One 2016

Due date: Friday 29 April 2016

Time: 5.00pm

Section

Marks

A5 B5 C 10 D 30

Total 50

StudentName/ID ………………………………………………………………………………………………….

CPIT and its faculty members reserve the right to use electronic means to detect and help prevent plagiarism. Students agree that when submitting this assignment, it may be subject to submission for textual similarity review to Turnitin.com.

Submissions received late will be subject to a penalty of 10% of the student’s mark per working day.

This assignment is worth 10% of the total marks for BCSE101. This paper has eleven (11) pages including the cover sheet.

Department of Computing Faculty of Commerce Computing

Assignment Description

https://en.wikipedia.org/wiki/Rugby_sevens_at_the_Summer_Olympics https://en.wikipedia.org/wiki/Rugby_sevens_at_the_2016_Summer_Olympics

The purpose of this assignment is to build part of a system that would be used to track results in the 2016 Olympics Rugby 7s competition. The class diagram below shows how this system is to be implemented:

Note:
This is a partial system. At the end of this assignment, once you have handed in your work,

you will be given a model answer. That will be the basis for the next assignment which will add more details (entering of results, calculation of pool winners) to what you have to do for this first assignment. Think of this as ‘iteration 1’ of the building of a larger system.

BCSE101 Jade Assignment 9/27/2011 Page 2 © CPIT

Department of Computing Computing

Controler.js

The following code should be used to load your test data.

var Controller = function () {
    "use strict";

};

Controller.prototype.setup = function () {
    "use strict";

Faculty of Commerce

    var the2016OlympicMens7s, bra, fij, usa, nzl, arg, jpn, rsa, aus, gbr, ken, fra, col, poolA,
poolB;
    the2016OlympicMens7s = new Olympic7s();
    // Add teams
    bra = the2016OlympicMens7s.addTeam("Brazil", "BRA", "Southern", 11, "A");
    fij = the2016OlympicMens7s.addTeam("Fiji", "FIJ", "Southern", 1, "A");
    nzl = the2016OlympicMens7s.addTeam("New Zealand", "NZL", "Southern", 3, "A");
    usa = the2016OlympicMens7s.addTeam("United States", "USA", "Northern", 5, "A");
    arg = the2016OlympicMens7s.addTeam("Argentina", "ARG", "Southern", 6, "A");
    jpn = the2016OlympicMens7s.addTeam("Japan", "JPN", "Northern", 9, "A");
    rsa = the2016OlympicMens7s.addTeam("South Africa", "RSA",  "Southern", 2, "B");
    aus = the2016OlympicMens7s.addTeam("Australia", "AUS", "Southern", 4, "B");
    gbr = the2016OlympicMens7s.addTeam("Great Britain", "GBR", "Northern", 7, "B");
    ken = the2016OlympicMens7s.addTeam("Kenya", "KEN", "Northern", 8, "B");
    fra = the2016OlympicMens7s.addTeam("France", "FRA", "Northern", 10, "B");
    col = the2016OlympicMens7s.addTeam("Columbia", "COL",  "Southern", 12, "B");
    // Add the Pool Matches
    poolA = the2016OlympicMens7s.poolA;
    poolB = the2016OlympicMens7s.poolB;
    poolA.addMatch(bra,fij );
    poolA.addMatch(bra, nzl);
    poolA.addMatch(bra, arg);
    poolA.addMatch(bra, jpn);
    poolA.addMatch(bra, usa );
    poolA.addMatch(fij, nzl);
    poolA.addMatch(fij, arg );
    poolA.addMatch(fij, jpn);
    poolA.addMatch(fij, usa);
    poolA.addMatch(nzl, arg);
    poolA.addMatch(nzl, jpn);
    poolA.addMatch(nzl, usa);
    poolA.addMatch(arg, jpn);
    poolA.addMatch(arg, usa);
    poolA.addMatch(jpn, usa);
    poolB.addMatch(rsa, aus );
    poolB.addMatch(rsa, gbr);
    poolB.addMatch(rsa, ken);
    poolB.addMatch(rsa, fra);
    poolB.addMatch(rsa, col );
    poolB.addMatch(aus, gbr);
    poolB.addMatch(aus, ken );
    poolB.addMatch(aus, fra);
    poolB.addMatch(aus, col);
    poolB.addMatch(gbr, ken);
    poolB.addMatch(gbr, fra);
    poolB.addMatch(gbr, col);
    poolB.addMatch(ken, fra);
    poolB.addMatch(ken, col);
    poolB.addMatch(fra, col);
    return the2016OlympicMens7s;

};

NOTE:
The match parings are fictions and the rankings may also change by the start of the Olympics.

BCSE101 Jade Assignment 9/27/2011 Page 3 © CPIT

Department of Computing
Computing Runner.html

Run your code using the following document.

<!DOCTYPE html>
<html>
<head>

Faculty of Commerce

  <meta charset="utf-8">
  <title>BCSE101 16S1 Programming Assignment 1</title>
  <!-- include source files here... -->
  <script src="src/Team.js"></script>
  <script src="src/Match.js"></script>
  <script src="src/Pool.js"></script>
  <script src="src/Olympic7s.js"></script>
  <script src="src/Controller.js"></script>
  <div id="divDisplay"></div>

</head>

<body>
   <script>
       var go = function () {
           "use strict";
           var controller, theOlympic7s, theDisplay;
           controller = new Controller();
           theOlympic7s = controller.setup();
           theDisplay = document.getElementById("divDisplay");
           document.body.style.fontFamily = 'Courier New';
           theDisplay.innerHTML = theOlympic7s.getAll();
      console.log(theOlympic7s);
};
       window.onload = go;
   </script>
</body>
</html>

BCSE101 Jade Assignment

9/27/2011 © CPIT

Page 4

Department of Computing Faculty of Commerce Computing

SECTION A TOTAL: 5 MARKS

Create the directories, files and constructors.

1. Createanewdirectoriesandbuildthenecessaryclasses.

Look at the provided Runner.html code on page 4 to see required directory and file structure.

Plan this by drawing a UML package diagram.

http://www.agilemodeling.com/artifacts/packageDiagram.htm

2. Write constructor functions for the Olympic7s, Pool, Team and Match classes. Look at the class diagram on page 2 of this assignment for the details.
Model your code on the ToyBox-Toy example code.
Create the files/constructors in the order: Team, Pool, Olympic7s and then Match.

SECTION B
addTeam
3. Write an AddTeam method for the Olympic7s class

TOTAL: 5 MARKS

The Pool class will an addTeam method
First create the new Team
Add it to the Olympic7s collection
According to the team’s poolCode, add the team to the appropriate pool

BCSE101 Jade Assignment 9/27/2011 Page 5 © CPIT

Department of Computing Computing

TOTAL:

TOTAL:

Faculty of Commerce

10 MARKS

30 MARKS

SECTION C AddMatch

4. Write an addMatch method in the Pool class

SECTION D
Writing get Methods

5. Write a getTeamsByNationality method that displays the nationality of each team in alphabetic order exactly as shown below.

The required output is:

(A) All Teams by Nationality
Argentina
Australia
Brazil
Columbia
Fiji
France
Great Britain
Japan
Kenya
New Zealand
South Africa
United States

(5 marks)

BCSE101 Jade Assignment

9/27/2011 © CPIT

Page 6

Department of Computing Faculty of Commerce Computing

6. Write a getTeamsByRanking method that displays the Teams in ranking order exactly as shown below.

(B) All Teams by ranking
Fiji
South Africa
New Zealand
Australia
United States
Argentina
Great Britain
Kenya
Japan
France
Brazil
Columbia

7. Write a getTeamsByPool method that lists by Pool the teams in alphabetic order exactly as shown below.

    (C) Teams BY POOL
    Pool A
    Brazil
    Fiji
    New Zealand
    United States
    Argentina
    Japan
    Pool B
    South Africa
    Australia
    Great Britain
    Kenya
    France
    Columbia

BCSE101 Jade Assignment

(5 marks)

(5 marks)

9/27/2011 © CPIT

Page 7

Department of Computing Computing

Faculty of Commerce

8. Write a getMatchesByPool method that lists in the order they were entered the matches in each pool exactly as shown below.

D) MATCHES BY POOL
Pool A
Brazil vs Fiji
Brazil vs New Zealand
Brazil vs Argentina
Brazil vs Japan
Brazil vs United States
Fiji vs New Zealand
Fiji vs Argentina
Fiji vs Japan
Fiji vs United States
New Zealand vs Argentina
New Zealand vs Japan
New Zealand vs United States
Argentina vs Japan
Argentina vs United States
Japan vs United States
Pool B
South Africa vs Australia
South Africa vs Great Britain
South Africa vs Kenya
South Africa vs France
South Africa vs Columbia
Australia vs Great Britain
Australia vs Kenya
Australia vs France
Australia vs Columbia
Great Britain vs Kenya
Great Britain vs France
Great Britain vs Columbia
Kenya vs France
Kenya vs Columbia
France vs Columbia

(5 marks)

BCSE101 Jade Assignment

9/27/2011 © CPIT

Page 8

Department of Computing Computing

Faculty of Commerce

9. Write a getNZMatches method that lists in the order they were entered the matches in each pool exactly as shown below.

(E) NZ Matches
Brazil vs New Zealand
Fiji vs New Zealand
New Zealand vs Argentina
New Zealand vs Japan
New Zealand vs United States

(5 marks)

10.Write a getNorthVsSouth method that lists in the order they were entered the matches in each pool exactly as shown below.

    F) NORTH VS SOUTH
    Pool A
    Brazil vs Japan
    Brazil vs United States
    Fiji vs Japan
    Fiji vs United States
    New Zealand vs Japan
    New Zealand vs United States
    Argentina vs Japan
    Argentina vs United States
    Pool B
    South Africa vs Great Britain
    South Africa vs Kenya
    South Africa vs France
    Australia vs Great Britain
    Australia vs Kenya
    Australia vs France
    Great Britain vs Columbia
    Kenya vs Columbia
    France vs Columbia

How to Submit your Assignment:

BCSE101 Jade Assignment 9/27/2011 Page 9 © CPIT

(5 marks)

  1. Submit all your \src directory files
  2. Submit via the PROG1 assignment DROPBOX on BCSE101 Moodle

Outcome

5

4

3

2

1

0

Mark awarded

Part A – Creating directories, files and classes

Part B – addTeam

  •  Hascreatedallofthe classes, references and relationships as shown in the diagram.
  •  Mostoftheattributes shown on the classes have been created.
  •  methodshavebeen created correctly with mostly good use of meaningful variable names, white space, indenting and commenting.

Mark Weight 1

  •  Has created all of the directories, files, class constructors, are correct
  •  Allattributesand collections have been created.
  •  Methodshavegood use of meaningful variable names, white space and indenting.
  •  Has created method which creates the team and adds it to the right collection
  •  The code has been written correctly with good use of meaningful variable names, white space, indenting, and transaction handling

Has correctly created the method

The code has been written correctly with satisfactory use of meaningful variable names, white space, indenting, and transaction handling

Has created all of the classes, and most of the references and relationships as shown in the diagram.

Most of the attributes shown on the classes have been created.

methods have been created correctly with satisfactory use of meaningful variable names, white space, indenting and commenting.

Has created the method for the most of it is correct

The code has mostly been written correctly with satisfactory use of meaningful variable names, white space, indenting, and transaction handling

Has created all of the classes, and some of the references and relationships as shown in the diagram.

Some of the attributes shown on the classes have been created.

methods have been created correctly with some use of meaningful variable names, white space, indenting and commenting.

Has created the method for the and some of it is correct

Some of the code has been written correctly with some use of meaningful variable names, white space, indenting, and transaction handling

Has created some of the classes, and some of the references and relationships as shown in the diagram.

Some of the attributes shown on the classes have been created.

methods have been created with no or little use of meaningful variable names, white space, indenting and commenting.

Has created the method for the BUT little of it is correct

Some of the code has been written correctly with little use of meaningful variable names, white space, indenting, and transaction handling

Has created none of the classes, and none of the references and relationships as shown in the diagram.

None of the attributes shown on the classes have been created.

No / incorrect methods have been created

Has not created
the necessary
methods Mark

None of the code has been written

Weight 1

School of Computing

Faculty of Commerce

Part C – addMatch

  •  Hascreatedthe method for the BUT little of it is correct
  •  Littleusehasbeen made of meaningful variable names, white space, indenting, and transaction handling

Mark Weight 2

Part D –
get methods for each part:

  •  Has correctly created the method
  •  Good use has been made of meaningful variable names, white space, indenting, and transaction handling
  •  Has written a method that works correctly as described
  •  Has correctly written any other methods that may have been needed
  •  Good use has been made of meaningful variable names, white space and indenting
    getTeamsByNationality
    getTeamsByRanking
    getTeamsByPool
    getMatchesByPool
    getNZMatches
    getSouthVsNorthMatches
    

Has correctly created the method

Mostly good use has been made of meaningful variable names, white space, indenting, and transaction handling

Has written a method that works mostly as described

Has correctly written any other methods that may have been needed

Mostly good use has been made of meaningful variable names, white space and indenting

Has created the method for the most of it is correct

Mostly good use has been made of meaningful variable names, white space, indenting, and transaction handling

Has written a method that works mostly as described

Has correctly written most other methods that may have been needed

Mostly good use has been made of meaningful variable names, white space and indenting

Has created the method for the and some of it is correct

Some use has been made of meaningful variable names, white space, indenting, and transaction handling

Has written a method that does some of what is required

Has correctly written some of the other methods that may have been needed

Some use has been made of meaningful variable names, white space and indenting

Has written a method that does little of what is required

Few other methods are used or those other methods that exist are incorrect

Little use has been made of meaningful variable names, white space and indenting

Has not created the method

No use has been made of meaningful variable names, white space, indenting, and transaction handling

Has not written a method

Has not written any other methods.

No use has been made of meaningful variable names, white space or indenting.

Mark Weight 1

Page 10 of 10

School of Computing