There are 7 questions
● All questions are worth 5 marks each
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 letter (5 marks)
Difficulty: 2
Requirements:
● Must be a console program
● When the program starts, a random character, c, is selected where c can be upper case (A to Z) or lower case (a to z).
● The user enters a character and the program displays
○ “higher” if the guess is less c
○ “lower” if the guess is greater than c
○ “correct” if the guess is equal to c
● 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 displayed
2. Screen saver (bouncing box) (5 marks)
Difficulty: 3
Requirements:
● Must be a graphics program
● When the program starts, a filled rectangle with random dimensions (width and height should be chosen randomly in [100 200]) is displayed on the screen in a random location
● The rectangle continues to move along a random path until it hits the edge of the window
● The rectangle bounces off the window and the process is repeated indefinitely
● You can get extra marks for multiple rectangles and visual/audio effects
3. Circle Drawer (5 marks)
Difficulty: 3
Requirements:
● Must be a graphics program
● The program reads a file redirected from standard input (e.g. build CircleDrawer < myfile.txt) which contains integers (three integers per line separated by a space) representing x and y coordinates on a Cartesian plane and the radius of the circle
● The program displays a corresponding set of circles in a window
● There is a maximum of 100 lines in the file
● You can get extra mark if you color each circle randomly
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:
50 50 30
190 50 10
200 170 50
120 210 20
50 120 20
Then, the following circles should be shown on 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 name my_pow to calculate the power of a number
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 of different type.
● Note that the second input in my_pow (exponent) should always be integer
● There would be a total of 12 methods excluding the main method
● You program will be tested by calling the above functions in the main function as follows:
import console;
void main
{
int x=5;
int y=8;
int o1=my_pow(x,y);
double[] arr1={2,4,9};
double o2=my_array_mul(arr1);
}
5. Word Sorter (5 marks)
Difficulty: 5
Requirements:
● Must be a console program
● Must read a file redirected from standard input (e.g. build WordSorter < myfile.txt)
● Must handle files with multiple words on each line and multiple lines
● Characters are in mixed case (upper and lower case, where A < Z < a < z)
● Outputs a list of one word per line of all the words in the file in ascending (A-Z,a-z) alphabetical order
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:
this fat cat
sat on the Mat
Then the output would be:
Mat
cat
fat
on
sat
the
this
6. Top-loader washing machine (5 marks)
Difficulty: 6
Requirements:
● Must be an nxt program
● Must use the robot configuration:
○ Port 1: Touch sensor
○ Port 2: Touch sensor
○ Port 3: Touch sensor
○ Port 4: Proximity sensor
○ Port A: Motor
○ Port B: Motor
○ Port C: Lamp
● The first touch sensor simulates the power button of the washing machine
The second touch sensor should be utilized for selecting the washing plan. The washing machine should have at least 2 washing plans (slow and fast) with three cycles: wash, rinse, and spin.
● Washing plans have different durations for wash, rinse, and spin.
● The third touch sensor is the lid sensor, which is pushed when the lid is completely closed.
● The proximity sensor checks if the washing machine is loaded or not.
● Motor A is attached to the lid, so you can open the lid using motorBackward(A,50) and close it with motorForward(A,50)
● Motor B is the main motor, which rotate a disk on the bottom of the washing machine
● You need to use the speaker to beep every time user hit the first two touch sensors
● You can also use the lamp to show if the machine is on or off
● Your washing machine has to print suitable messages on the screen for users (status of the machine, washing plans, time, etc.)
● The speaker is also used to warn parents if a child opens the lid during the operation of the machine.
7. Flappy bird game (5 marks)
Difficulty: 6
Requirements
● Must be a graphic program
● Flappy Bird is a side-scrolling game featuring 2D retro style graphics. The objective is to direct a flying bird (or a circle), which moves continuously to the right, between sets of Mario-like pipes (or rectangles). If the player touches the pipes, they end the game. The bird briefly flaps upward each time that the player press a key; if the key is not pressed, the bird falls because of gravity. The player is scored based on the number of pipes that the bird (or circle) successfully passes through, with medals awarded for the score at the end of the game.
In the original version of this game, there is no variation or evolution in gameplay throughout the game as the pipes always have the same gap between them and there is no end to the running track, having only the flap and ding sounds and the rising score as rewards. However, you may be awarded extra marks for any of the following:
Sound effects.
• Images/fancy graphics.
• Scoring system/lives
• Main menu
• Any other interesting feature that you think is beyond the basic game (moving background, gameplay, etc.)
Note: You should describ the input controls for your program in the comment at the top of the mash source file.
The following image shows the simplest version of this game that can be submitted for this question:
To get assignment help, please contact to our live chat adviser