Arrays Programming Tasks
ONLY upload your HeAD with Code copied as text and Screenshots of console windows with the code running
- Complete at least 5 chips worth of Problems... (at least one of the problems you attenmpt MUST be a 2D array solution)
1D Problems
1) Random Person Picker (1 Chip)
Write a program that will pick a person from a list of 10 names at random.
Your program should:
- Allow the user to enter the names (just first names will do).
- Pick one person from the list and display their name
2) Biggest number (2 Chips)
Write a program that will find the largest number of values stored in an array
Your program should:
- Allow the user to enter 5 values into the array
- Return the Largest number and it's position in the array
3) Letter Count (2 chips)
Write a program that works out how many letter a's there are in an inputted string
Your program should:
- alloow the user to input a string
- allocate each character to an element in an array (you can access the characters using array notation on the string)
- Count and output the number of times the letter a appears
For an extra chip modify this program to count how many time each vowel appear keeping a running total in a 5 element array
4) Name Search (2 Chips)
Write a program that will find a name in a list stored in an array
Your program should:
- Allow the user to enter the names (just first names will do).
- Allow the user to enter the name they wish to search for
- Return if the name is in the array and it's position
5) Reversal (2 Chips)
Write a program that will reverse the values store in an array (so the first value is the last etc..)
Your progam should:
- Alow the user to enter 5 values (or strings)
- Display the array in the original order
- assign the values on reverse element order to a new array
- Display the new array...
NB you must not just display the array in reverse order
6) Tally Chart (2 Chips)
Write a program that counts and displays how many time a specifc number is entered.
i.e. if the user entered: 1 3 2 5 1 2 2 3 1 4 the program would output #1s=3, #2s=3, #3s=2, #4s=1,#5s=1 total numbers entered =10
- Allow the user to enter upto 20 numbers (between 0 and 9)
- tally how many of each number is entered
- display the tally as above (or an appropriate table)
- EXTENTION! the user is allowed to enter ANY integer (2 extra chips!)
2d problems
7) SELECT NAMES (2 Chips)
Write a program that will produce a list of names where the surname is longer than the firstname
The program should:
- allows the user to enter 10 names (firstnames and surnames) into an array.
- Compare the length of each first name and surname
- Display a list of all the names where the surname is longer than the firstname
8) EXPERIMENT AVERAGE (2 Chips)
Write a program that allows the user to enter data for an experiument that times how long it takes for a ball to fall a set distance.. As a good scientist you repeate the experment and take the average of the two values for each height e.g.
Height | Time 1 | Time 2 | Average |
The program should:
- alow the user to enter height and two times and add it to the array
- Calculate the average for each height and assign it to the four "column" of the array
- Display the whole table in a reasonable format
9) FIND THE MOLE GAME (3 chips)
Write a program that uses a 10x10 grid with one element hiding a "mole" that the user has to find.
The program should:
- Display a 10x10 grid with the x and y axis labled 1->10
- Asks the user for the cordinates that they would like to "dig for a Mole" (probally on 2 seperate inputs)
- Marks on the grid where the user has dug
- tells the user if they found the mole of not
Extension (1 chip).... use Letters on the y-Axis and alow the user to input the coordinates as a single input
As always... I want a HeAD with the copy and paste of the entire code. and screenshots showing the program running.