Assignment A

Document Sample
Assignment A Powered By Docstoc
					Assignment H. Due Thursday, April 27
World Class Video Movie Management System.

We have played around with movie management programs for a while, so lets put it all
together into a reasonably complete package. This won’t add or edit movies or
customers, but it does manage the rental operations which is the core application.

On BigDawg, under apps/classes/mist4600/download/goodhue/assignH, you will find
files for two forms and a VP project, along with a Movie7.mdb. Download these. The
first form is the initial form for this project, and the second is the movie check out form.
You will need to do two things.

First, extract the code for finding the price of a movie (based on customer membership
status and movie type) from the existing Check Out program and put it in a function that
can be called from either Check out or Check in. (This means it must be in a module).

Second, you will need to write the code for movie check in. (Exit code is already
provided.)

1. You should look over the code for “Check Out a Movie”, since as it turns out
checking in a movie has many similarities to checking one out. The program validates
that customer ID and movie ID are valid numeric fields and makes sure they exist on the
database. The program then displays the price of that movie for this customer (based on
movie type and customer membership status). It also adds in any outstanding late fees
for that customer, and the total. (Let’s ignore taxes!) The clerk then either finalizes the
rental or cancels it. Finalizing the rental reduces the late fees for this customer to zero,
adds the CustomerID to the movie customer field, adds today’s date plus two to the
DateDue field, and clears the screen to make ready to add another customer and movie.
(For simplicity, we assume each customer only rents one movie each time they go to the
desk, though they might make several trips.)

2. For “Check In a Movie”, add a new form that asks only for the MovieID. Given the
MovieID the program should check to make sure it is a valid ID, (positive and numeric)
and then that it is on the database and checked out to someone. (When the customerID
on the movie file is = 0, the movie is not checked out). Assuming all that is valid, you
must determine if the movie is on time or late. You may want to use some variation of
the following function provided by VB:
         DaysLate = DateDiff("d", DueDate, Date)
(This give you the number of days difference between DueDate and today’s date)
If the movie is late, you must determine the late charge (price * DaysLate), and you must
utilize the function that you wrote for part 1. Then access the customer information and
add the late charge to the existing LateFees for that customer. (For simplicity, assume
that any CustomerID in the Movie Table is a valid customer ID.)

Finally set the CustomerID in movie = to 0, and set the due date equal to 1/1/50, the date
meaning the movie is not checked out.
Assignment G.
Due April 13, 2000

Arrays, Sorting and Locating Particular Movies. Write a program to read in movie
information and sort it into various orders, as follows.

1. As part of the load form event, read from the Movie3.txt file (Download it from
bigdawg (G or F apps/classes/mist4600/download/Goodhue/Assign G and put it on drive
A), and put the data into six appropriately named arrays. The data in the file is movie ID,
movie name, price, times rented, customer checked out to, and date due. You will ignore
the arrays for price, customer checked out to and date due from here on out.

2. Add three list boxes for MovieID, MovieName, and TimesRented. Add a command
button which will clear the current contents of the list boxes, and then load the list boxes
with values from the arrays in whatever their current order is.

3. Include a button to sort the three arrays for MovieID, MovieName, and TimesRented
into descending order by TimesRented.

4. Include another button to sort the three arrays into ascending order by TimesRented.

5. Include another button to sort the three arrays into alphabetical order by MovieName.

In all cases, make sure you sort the arrays, not the list boxes. The only time the list boxes
come into play is when you press the command button to display whatever values are in
the arrays.

6. Include a textbox for inputing a MovieID, and then display (in text boxes or labels)
the MovieName and the TimesRented for that movie. Again, use the arrays to get this
info, not the list boxes.

Assignment F. Due Thursday, March 30.
World Class Video Customer Information Query, using Database Access.

Write a VB program that will allow a user to input a customer ID, then press one of two
command buttons (not counting the exit button). The first command button will access
the Customer Table of Movie6.MDB (download it from the F or G drive in BigDawg,
APPS/Classes/MIST4600/download/Goodhue/Assign-F) and show the Customer Name,
Membership Status, and Outstanding Late Fees for this customer. The second command
button will scan the Movie Table of Movie6.MDB to find all movies checked out to this
customer, and display the Movie ID, Movie Title, and Due Date in list boxes at the
bottom of the form. A template form is also available on BigDawg, in the same location.
Get Customer Information. The first command button requires a fairly straightforward
access of a database. Make sure you do not link the textbox for Customer ID to the
database – but you will use that textbox value in your “FindFirst” method when you
access the database. You might use labels rather than textboxes for Name, Member
status and late fees, since you don’t want to change these values. You should check for
valid, numeric fields before you try to access the database, and consider the possibility
that a given customer ID will not be in the database (a nomatch), and deal with that
effectively.

One possible enhancement here is to make the labels for name, member status and late
fees invisible until you have entered and successfully found a customer on the database.
Otherwise your form will display information for the first customer, even before you
have entered any customer ID.

Show Movies Checked Out. Here you should first check to make sure you have a valid
customer ID that is on the database. (One way to do this is to rerun the “Get Customer
Information” event from within this procedure. Just add a line to your code that has the
command button name, followed by no spaces and “_Click”. Then make sure the Get
Customer Information procedure has a flag to indicate if Get Customer Information was
successful.)

Once you are sure you have a valid Customer ID, you will need to loop through the
movie database, finding all records with this customer ID. Let me suggest one approach:
       First use the FindFirst method (with a specified value for customer ID) to locate
       the first movie checkout by this person. If you have a no match at this point, then
       the customer has no movies checked out.

       Then loop through all the records with this customer ID, each time adding the
       appropriate values to the lists, using something like the following command:
               lstMovieID.additem datMovie.recordset!MovieID
and then using the FindNext method (again with the specified value for Customer ID). A
statement such as: Do until lstMovieID.recordset.nomatch will set this up.


Assignment E: The ATM program Using Databases.

Due 3/21

Make a copy of your ATM program from Assignment D, and convert it from files to a
database. I have reproduced the text from assignment D below, and modified to apply to
the database version of the program. You will find that most of your code still works just
fine. If you lost points for not making the program idiot proof on Assignment D, now’s
your chance to correct that.

You will not need the first button from Assignment D. You will not need the list boxes.
Instead replace each with a text box. You will therefore have two textboxes for
AccountID, one that replaces the listbox, and one that is the “targetID”. I will pass out to
you copies of the database (ATM-E.mdb) in class. You will obviously need a data control
that links to this new database

The second command button must take an account ID specified in the “targetID” text
box, and cause that customer’s name, ID, and account balance to appear in the text boxes
(those that replaced the listboxes). This will require a “findfirst” command for the
database using the target ID.

The third button must allow a customer to specify a dollar amount for withdrawal in a
text box, then check for available funds, and will change the account balance in the text
box appropriately. Remember that you will already have determined (in the paragraph
above) which location in the lstBalances is the right one to change. Don’t allow any non
numeric or negative amounts

You won’t need the old fourth button.

The fifth button will end the program. There are no files to close.

Make sure your program is idiot proof. That means that it will act appropriately if
someone pushes the buttons in the wrong order or clicks on the wrong things. (You
might make some buttons invisible until the proper time to prevent this.) Your program
should also make sure that inappropriate deposit amounts are handled appropriately.


Assignment D

Due 3/2

The ATM program. Design an ATM program that will have five command buttons.

The first command must cause data (customer names, account IDs, and balances) to be
read in from the A:atm.txt file and put into three list boxes. You will find the input data
at http://www.cba.uga.edu/~dgoodhue/assign-d.htm. For now, don’t worry about formatting
the dollar amounts.

The second command button must take an account ID specified in a text box, and
highlight that customer’s name, ID, and account balance in the list boxes. This will
require looping through all values in the AccountID listbox, until you find one that
matches the AccountID in the text box. At this point the index of your FOR loop will be
the proper position in the listboxes for that account. If you set the listindex of any one of
the list boxes (for example lstAccountID.listindex) to that value, it will highlight the
proper spot. (Perhaps you should set enabled = false for the list boxes so that no one can
change the listindex by clicking on an entry)

The third button must allow a customer to specify a dollar amount for withdrawal in a
text box, then check for available funds, and will change the account balance in the list
box appropriately. Remember that you will already have determined (in the paragraph
above) which location in the lstBalances is the right one to change.

The fourth button will open a new file (A:atm2.txt) and output the updated account
information to the new file.

The fifth button will end the program, closing all files.

Make sure your program is idiot proof. That means that it will act appropriately if
someone pushes the buttons in the wrong order or clicks on the wrong things. (You
might make some buttons invisible until the proper time to prevent this.) Your program
should also make sure that inappropriate deposit amounts are handled appropriately.

Assignment C

Due 2/17
Loan Balances. Loops and Lists. Design a program that will take as input four items: A
beginning loan amount, a monthly payment amount, an interest rate, and the number of
months (10 or less) to report on. Your program should create a table constructed of list
boxes that will look something like the following:

Interest Rate: 12% (1%/Month)
Month          Principal               Payment        Interest       Principal
               (Start of Month)                                      (End of Month)
1              1000.00                 100.00         10.00          910.00
2              910.00                  100.00         9.10           819.10
etc.

Note that the table will only have as many lines as you have asked for, and no more than
10. Make sure your program will recognize if the loan is paid off before 10 months are
up, and what the final payment ought to be.

Format the items in the lists. Remember that a currency format produces a string, not a
number. Using the val() function on a string returns a zero, so you will want to keep all
your accumulating values in defined variables, not text boxes. Just move them to text
boxes for display purposes.

Assignment B. Adapted from Robertson’s Simple Program Design, page 31, #4.
Due 2/1

A program is required to read in a customer’s account balance at the beginning of the
month, a total of all withdrawals for the month, and a total of all deposits made during the
month. A federal tax charge of 1% is applied to all transactions (withdrawals or deposits)
made during the month. The program is to calculate the account balance at the end of the
month by taking the account balance at the beginning of the month and (1) subtracting
the total withdrawals, (2) adding the total deposits, and (3) subtracting the federal tax.
The customer’s end of the month balance should then be displayed.
The program will need to be able to cycle through all the bank’s customers. (At this
point we assume that someone will have to type in each customer’s data in turn from
some ledger book, and then record their new balance on the ledger book.) This means
there needs to be a “clear” button that will remove one customer’s data and make ready
for the next customer.

Finally, we want to keep a running total of the federal tax charged to all customers
combined. (Obviously this running total should not be zeroed out when we press the
“clear” button.) The total federal tax charged should be invisible until a button is pressed
making it visible, presumably after all customers are processed. (But you might add this
invisibility after you are sure the program is working)

Suggestion: Use a prototyping approach to getting the complete program written. That
is, get the first paragraph above to work without worrying about the rest. Then get the
first paragraph and the second paragraph to work. Finally get the whole program to
work.

You must define all variables, and do all arithmetic on variables (not text boxes)

Assignment A.
Due 1/18
Programming Exercise 2 on page 51 of McKeown. You will need to read the chapter to
find out how to use the msgbox feature of VB. Any appropriate image will do.

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:47
posted:10/1/2012
language:English
pages:6