Create a class that is generic that has an 1 array with size of 20 in it and 1 porition variabable .
create a generic add method that add any elements specified for the array to the last available item in the array . if the array is currently full , you have to remove the first element and push the remaining element up and add the new element at the last position.
Create a remove method that remove the last item by nullified/vacant that particular array position.
Create a print method that print all the element
SADI - Software Architecture , Design and Implementation
Tuesday, 11 March 2014
Tutorial 1 - Question 2
Creata a generic method that ill be used in class that will print any Array elements that it been supplied with regardless the type .
Tutorial 1 - Question 1
Question 1
Write a generic method to find the maximal element in the range [startrange,endrange] of a list/ where the startrange is the starting position of the list ,[endrange] is the end position within the list.
Write a generic method to find the maximal element in the range [startrange,endrange] of a list/ where the startrange is the starting position of the list ,[endrange] is the end position within the list.
Wednesday, 7 March 2012
Lab 01 -Question 2
Write a program that will read any given text file (filename passed as command line argument)
and print the number of occurrences of each word. Assume that words can be delimited by a
space, a comma, a newline or a full-stop. You are required to use a HashMap to store the word
count.
and print the number of occurrences of each word. Assume that words can be delimited by a
space, a comma, a newline or a full-stop. You are required to use a HashMap to store the word
count.
Lab 01- Question 1
DO question 1 & 2 and submit the work to rimiazizi@gmail.com , before 12.10 noon today.
Performing set operations on hash sets
a) Allow user to enter two set of staff names, one for those who play cricket and one for those
who play tennis.
b) Read and store the names in two HashSet objects.
c) Using these two sets perform the necessary operations to print the following:
i. The names of staff playing both cricket and tennis
ii. The names of staff playing either one or both
iii. The names of staff playing cricket but not tennis
iv. The names of staff playing tennis but not cricket
Performing set operations on hash sets
a) Allow user to enter two set of staff names, one for those who play cricket and one for those
who play tennis.
b) Read and store the names in two HashSet objects.
c) Using these two sets perform the necessary operations to print the following:
i. The names of staff playing both cricket and tennis
ii. The names of staff playing either one or both
iii. The names of staff playing cricket but not tennis
iv. The names of staff playing tennis but not cricket
Subscribe to:
Comments (Atom)