Assignment title: Management
1001ICT Project (35%)
Due: 5.00 pm on 20/01/2017 via e-mail submission: [email protected]
Cheating policy: All programs will be compared with one another and any students involved in sharing
programs will receive zero marks and may receive permanent record on their official university transcript or
face expulsion from Griffith College.
● There are 7 questions
● All questions are worth 5 marks each
When submitting, please place all mash files in a zip file. Mash files should be named Problem1.mash,
Problem2.mash, etc.
LATE SUBMISSIONS will be marked according to Griffith College assignment submission policy (-
10% for every day late).
Marks will be deducted for poorly formatted code, code that does not compile, or code that does not
contain a comment block at the top of the file describing the program.
Learning outcomes:
This assessment item relates to the following learning outcomes:
1. An understanding of programming tools (editors and compilers);
2. An understanding of the properties of binary data, text data and the files that contain them;
3. How to interpret the formal specification of the syntax of a programming language;
4. How to create programs that consist of calls to procedures that perform actions;
5. How to interpret an API (Application Programming Interface);
6. How to create programs that declare variables, assign values to them, and call functions to return values;
7. How to create programs that involve repetition with definite and/or indefinite loops;
8. How to write programs that use selections;
9. How to write programs with multiple methods that call each other, sharing data with global variables
and/or parameter passing;
10. How to create programs that use arrays;
11. How to document programs with comments; and
12. How to debug programs.
13. Apply all of the above to solve problems with computer software.1. Guessing game (5 marks) Difficulty: 2
Requirements:
● Must be a console program
● When the program starts, a random number, n, is selected where n >= 1 and n <= 100
● The user enters an integer guess and the program displays
○ "higher" if the guess is less n
○ "lower" if the guess is greater than n
○ "correct" if the guess is equal to n
● The game continues until the user enters a correct guess and then the program quits
● When the program quits, the total number of guesses is displayed2. Screen saver (bouncing name) (5 marks) Difficulty: 3
Requirements:
● Must be a graphics program
● When the program starts, three Strings should be read from the user and displayed on the screen in
random locations
● The Strings continue to move along random paths until they hit the edge of the window
● The Strings bounce off the window and the process is repeated indefinitely
● You can get extra marks for visual/audio effects and if you get the user to click mouse and add more
bouncing Strings to the window3. Polygon Drawer (5 marks) Difficulty: 3
Requirements:
● Must be a graphics program
● The program reads a file redirected from standard input (e.g. build PolygonDrawer < myfile.txt)
which contains integers (two integers per line separated by a space) representing x and y coordinates
on a Cartesian plane
● The program displays a corresponding polygon in a window
● There is a maximum of 100 lines in the file
Tips:
● Input redirection simply enters the entire contents of a file as standard input, line by line. You can
use isNextLine() to determine if there is still data waiting to be read from standard input.
Example:
If the input file contains:
5 5
19 5
20 17
12 21
5 12
Then the following polygon should be drawn in the window:4. Calculator (5 marks) Difficulty: 4
Requirements:
● Must be a console program
● Must have multiple methods
● You program should simulate a simple calculator with (at least) the following methods:
o A method named my_mul to multiply two numbers
o A method named my_array_mul to multiply the elements of an array
o A method named my_add to add two numbers
o A method named my_array_mul to add the elements of an array
o A method named my_sub to subtract two numbers
● You need to overload the methods to handle both double and integer data types. This means that
you have to define two methods for each of the above methods with similar names but with inputs
and outputs of different type.
● There would be a total of 10 methods excluding the main method
● The array that your functions receive would always have five elements
● You program will be tested by calling the above functions in the main function. For example:
import console;
void main
{
int x=5;
int y=8;
int o1=my_mul(x,y);
double[] arr1={2,4,9,10,-2};
double o2=my_array_mul(arr1);
}5. Password Checker (5 marks) Difficulty: 5
These days, many systems require users to have passwords that meet certain criteria to make them harder to
compromise. At Griffith College, your password must be of a certain minimum length (8 characters) and
contain upper and lower case letters and at least 1 number.
For this problem, you need to write a method to verify the integrity of a password. The method should have
the following formal definition.
boolean isValidPassword(String pwd)
Implement the above method to verify that a provided password meets the following criteria:
• Password must be at least 8 characters long
• Password must contain at least 1 number, 1 lowercase letter and 1 uppercase letter
• Password must contain at least 1 non alpha-numeric character from the below list:
o ! @ # $ % ^ & * ( ) [ ] \ | ? /
• Password should NOT contain any character that is not a letter or a number or on the above list.
When you finish the method, write a main method and test the method with several example. You may use a
while loop to get the user to type a password and check it as well.6. Robot sensory (5 marks) Difficulty: 6
Requirements:
● Must be an nxt program
● Must use the robot configuration:
○ Port 1: Sound sensor
○ Port 2: Proximity sensor
○ Port 3: Light sensor
○ Port 4: Light sensor
○ Port A: Motor
○ Port C: Motor
● Robots are beginning to become more common in everyday life. There are already consumer robots
being used in houses today (Rhumba vacuum cleaner). Another potential use of robots is as a mobile
sentry. For this problem, you must write a program for the ScorpioBot (details mentioned above, same
robots we have been using for most of the semester) that will patrol a path and alert the owner if a
foreign object is detected.
● The robot must follow a patrol route along a grey path (with white around it) that is terminated by 2
black boxes. The path is narrower than the width of the robot, so when it is on the path, both light
sensors will read white. Images of the path are on the course website. When the robot reaches a black
box, it must turn 180 degrees and proceed back along the path to the other end. At any time during its
travels, if the robot detects an object within 25cm, it must stop and sound an alarm (beeping once a
second). When the object is removed, the robot should return to its patrol.
● A SIMILAR but not identical example can be seen in the below video from the 2:00 minute mark.
http://www.youtube.com/watch?v=AUy0OMVKLRw
Tips:
This problem is easiest solved by breaking it down into sub problems. Some of these are:
• Following a grey path (adjusting motor power based on light sensor values)
• Turning 180 degrees (when you reach the black box at the end). 180 degrees is half a circle. Consider
the distance between the wheels on the Scorpiobot (approx. 10cm) in your calculations.
• Alerting the user on object detection7. Space Invaders (5 marks) Difficulty: 6
Space invaders is a well-known arcade game that gave rise to an entire genre of vertical scrolling
action games (1945, Raiden, etc.) For this problem, you need to implement your own arcade game
based loosely on space invaders. At a minimum, you need to have a ship that can be moved left or
right and fire a weapon. There must be enemies to hit and they should advance or move in some
way. A correct basic implementation is worth 4 marks. In addition to this, you may be awarded extra
marks for any of the following:
• Sound effects.
• Images/fancy graphics.
• Enemies that move in patterns or other interesting ways.
• Moving the player ship in all 4 directions via the mouse
• Scoring system / lives
• Main menu
• Any other interesting feature that you think is beyond the basic game. (Different
weapons/super weapons/boss fights (If not obvious, feel free to describe this in a comment
in your source code).
• Note: You should describe the input controls for your program in the comment at the top
of the MaSH source file.Good luck!