hts.StevenWood.com

Labs

Home ] Up ] InitArray.java ] InitArray1.java ] InitArray2.java ] SumArray.java ] SumArray1.java ] SumArray2.java ] Exercise 4-2-1 ] Exercise 4-2-2 ] Exercise 4-2-3 ] [ Labs ] Rubric ][ Last Page ]

Data in Lists – Sample Lab Exercises

  1.  To use the “speed dial” feature of your home phone you must first store each of the phone numbers that you wish to use. Each phone number is accessed by entering the speed-dial number, from 0 to 9, used for storing the number. Write a program that will help you remember who’s phone number you have stored with each speed dial number. Your program must use an array to store the list of names. The user enters a number from 0 to 9 and is shown the name of the person that would be called if you entered that speed dial code into the phone. Store the data from the array in a sequential file.

  2.  Write a program that allows the user to enter up to 20 numbers to be stored in an array. When the user has finished entering numbers, calculate and display the sum of the numbers, the mean (arithmetic average) of the numbers, and the largest and smallest values entered.

  3.  Create a program that reads a list of no more than 100 names from a sequential file into an array. The names are stored in the file in the form “last_name, first_name.” Allow the user to display the list; add, modify, and delete names; and save the modified list in a sequential file with the same name.

  4.  Write a program to simulate rolling two dice together 100 times. Count the number of times each result (i.e., total of the two dice) occurs and print out the results. Note that rolling two dice together is not the same as picking a number from 2 to 12!! (If you really turn on your problem-solving skills, this program can be most easily done WITHOUT AN IF STRUCTURE!!)


Source: Public and Catholic District School Board Writing Partnership Course Profile: Computer and Information Science, Grade 11, University/College Preparation ICS3U, Queen’s Printer for Ontario, 2001, adapted.

Home ] Up ] InitArray.java ] InitArray1.java ] InitArray2.java ] SumArray.java ] SumArray1.java ] SumArray2.java ] Exercise 4-2-1 ] Exercise 4-2-2 ] Exercise 4-2-3 ] [ Labs ] Rubric ][Last Page]
All material on this site is copyright © 1997- by Steven Wood or as credited. All right reserved. Use of this site indicates you agreement with the  terms of use.
Send comments or questions to about this page.
Every attempt has been made to credit work under copyright. If there are any claims that copyright has been missed please contact the .
+SDG+