Sei sulla pagina 1di 4

College of Computing and Informatics

Assignment 2
Deadline: Day 30/11/2019 @ 23:59
[Total Mark for this Assignment is 5]
Student Details:
Name: ### ID: ###

CRN: ###

Instructions:

 You must submit two separate copies (one Word file and one PDF file) using the Assignment Template on
Blackboard via the allocated folder. These files must not be in compressed format.

 It is your responsibility to check and make sure that you have uploaded both the correct files.
 Zero make will be given if you try to bypass the SafeAssing (e.g. misspell words, remove spaces between
words, hide characters, use different character sets or languages other than English or any kind of
manipulation).

 Email submission will not be accepted.


 You are advised to make your work clear and well-presented, marks may be reduced for poor presentation.
This includes filling your information on the cover page.
 You MUST show all your work, and text must not be converted into an image, unless specified otherwise by
the question.
 Late submission will result in ZERO marks being awarded.

 The work should be your own, copying from students or other resources will result in ZERO marks.
 Use Times New Roman font for all your answers.
Pg. 01 Question One

Learning
Outcome(s): Question One 1 Mark

LO4: Write a for Loop statement and a While Loop statement to print Odd numbers
from 10 to 0.
Develop a
Note: Write your code in here as a text, a screenshot of the code will not
program based on
be accepted.
specification
using Typical run:
programming
language
elements
including syntax,
data types,
for loop While loop
conditional
statement, control
structures,
procedures and
arrays.
Pg. 02 Question Two

Learning Question Two 2 Marks

Outcome(s): Write a java program that do the following:


A. declare an array of integers and initialize it with your own Student ID
LO3+LO4:
digits (each element of the array should have one digit).
Demonstrate
B. Using an enhanced for loop, print the array elements.
Integrated
Development C. Ask the user to input an integer number and store it in a suitable
Environment variable.
(IDE) for the D. using a traditional for loop, count how many elements in your array
editing, building, matches the user input.
debugging, and E. Print the result of the count.
testing of F. show a screenshot of the output.
programs.
Note: Write your code in here as a text, a screenshot of the code will not
Develop a
be accepted.
program based on
specification
using Typical run 1 Typical run 2
programming
language
elements
including syntax,
data types,
conditional Typical run 3
statement, control
structures,
procedures and
arrays.
Pg. 03 Question Three

Learning Question Three 2 Marks

Outcome(s):
Write a Java Program that do the following:
LO3+LO4: A. Create an ArrayList of type Integer.
Demonstrate B. Store 20 random integer numbers in the ArrayList using a for loop. The
Integrated
random numbers range should be between 1 and 100.
Development
C. Print the ArrayList using a print statement.
Environment
D. Find and print the average value of the entire ArrayList.
(IDE) for the
editing, building, E. Run the program multiple times. show at least 4 screenshot of the
debugging, and outputs.
testing of F. Write your observation on the value of average.
programs.
Note: Write your code in here as a text, a screenshot of the code will not
Develop a be accepted.
program based on
specification
Typical run 1:
using
programming
language
elements
including syntax, Typical run 2:
data types,
conditional
statement, control
structures, Typical run 3:
procedures and
arrays.

Typical run 4:

Potrebbero piacerti anche