Ch 6 Programs – Using Data files

 

Address Labels

Phone Book

Report Cards

 

 

Address Labels Program – Creating OUTPUT files

 

Write a program that asks the user for the following mailing address information:

 

After the user has entered this information, the program creates an output file that prints the information as an address label using the following format:

First Last

Street Address

City, ST  ZIP

 

Before the output file is created, the user is given the choice of using a MS Word file or a text file as their output.  Use a numeric menu to let the user choose (For example, 1 = MS Word, 2 = Text File)

 

Once your program works, you should be able to run the program, enter information, and then open the output file from the H: drive and print the label.  You do not have to supply a printout, but this should be the outcome.  Save the program as LABELS.

 

Extension #1:  Try to adjust your program so that it creates 30 of the same labels on a page:  3 columns across and 10 rows of labels.

 

Extension #2:  Adjust your program so that the mailing information is stored as DATA instead of entered by the user.  Using a trailing record, this would make it easy to add names and addresses to your program – creating a virtual address book of sorts.

 

Extension #3:  Try to add other file types to your menu (such as PowerPoint, web page…etc)

 

Phone Book Program – Appending to an existing data file

 

Write a program that allows the user to enter some contact information about people to store in an electronic “phone book” that continues to grow as contacts are added.  When the user runs the program, they should see a title screen that shows the name for your program (think of a good name) and the programmer information.

 

After the title screen, the user is asked if they would like to add a new contact to their phone book.  They should answer y or n.

 

If the user answers no, the program ends.  Otherwise, the program asks them for the following information:

 

After the user has entered this information, the program opens a phone book data file and sends the information to the phone book using the following format:

 

<Last>, <First>

Home Phone:  <home>

Cell Phone:  <cell>

 

Note:  Close the data file when done.

 

After the user has entered one contact, they should be given the choice of adding more contacts.  The program should continue adding names until the user says they are finished.

 

This program should maintain a phone book between program executions through the use of appending.  Any phone numbers I enter today should still be there tomorrow!  You will need to APPEND.

 

Report Card Program

 

Assume an area high school has a program that helps manage report cards.  Anyone in the school can use the program, but people have different access levels:

 

Your job will be to write a program that allows the user to attempt to log in to the program.  There will only be a small number of users that have valid usernames and passwords to log in.  If the user is granted access to the program, they are given options based on their level of access. 

 

Below is a list of users:

 

User

Username

Password

Access Level

Stu Dent

dents

1234

1

Ima Pupil

pupils

4567

1

Matt Offenbecker

offenbeckerm

1111

2

Jim Smith

smithj

2222

2

Rich Syring

syringes

9876

3

Jill Sebald

sebaldj

6543

3

Steve Seventer

Steveners

9999

4

Phil Heller

hellers

007

4

 

First, store each user’s information in the program as DATA. 

 

Next, create a log in screen that has the user enter their username and password.

 

After the user enters this information, the program should READ through the entire list of DATA.  If the information typed by the user matches any of the records, the user is granted access.  Otherwise, the program denies access.

 

After access is granted, the program should list their options according to their access level.  For instance, if Rich Syring is logged in, he has the following options (because he is level 3 access):

 

After each successful login, the program updates a data log of users.  It should show the user’s first and last name along with the date and time they logged in.  You can print the date by using the DATE$ command and the time using the TIME$ command.   Every time a successful login occurs, the data file should grow.

 

This program does not actually allow the user to make a choice and act on their choice.  It should just let them attempt to log in and give them their options if they successfully log in as well as creating a security log.