Department of Economics
Mandatory Asssigment 1
Task in VBA, Userforms
A middle-aged shopkeeper is annoyed because his younger shop assistants often make mistakes when they give change to customers. Since the sales process already is based on a Windows pc, he orders a program that can tell the sales person what coins and notes shall be returned to the customer. He also buys a box with a compartment for each type of currency unit, and thus hopes to remedy the problem. Write this program.
As a first release the program is written so it can give change to a 100 kr. note; the change paid out should be in the smallest possible number of coins/notes. The payments are smaller than 100 kr. and can have odd amounts in øre. The rules from the present law about rounding of cash change, should therefore be included.
The rounding rules are that the amount to be paid (not the change) is to be rounded to an øre amount divisible by 50. Thus both a payment of 37.25 and a payment of 37.74 means that 37.50 is to paid, with a change of 62.50. (The mathematically inclined will note the asymmetry of the payer/payee situation).
As user interface a small form is constructed with e.g. a button, a textbox and a label. The sales assistant enters the amount to be paid and presses the button. The program then writes in the label which coins and notes the customer shall receive as change.
Further creativity in the user interface is absolutely allowed.
A recommendable method for the work would be: define user dialog, define program structure (paper) and then write the program.
Give verbal arguments for the chosen program logic, for instance10 lines of text.
Consider whether the chosen logic is appropriate, could it be generalized more? A general logic would be easier to transfer to other currencies. Is your solution easy to maintain, if the coin structure changes?
Note that this programming job requires knowledge of: control structures, arrays, label, textbox and type conversion, subjects which we have covered in the lessons.
The assignment can be solved in groups (recommended) and is handed in on Absalon. (See coming note).
It is important that the finished assignment is one document, and that it shows, as well uses of the program as the constructed program logic. Try to show essentials. The answer should also include an argumentation for the chosen design.
Department of Economics
Mandatory Asssigment 2
VBA and Database task
The assignment consists in making VBA based applications that take and process data from a database.
The database is an Access database and is called funds.mdb, on Absalon. It is used for the administration of portfolios of stocks. (funds.mdb is to be considered a fragment of a database, with more tables).
The present database has 4 tables. The table Stock contains a list of stocks (OMX Copenhagen 20), the table Day_list contains the actual quote, and the table Portfolio contains a number of portfolios, i.e. collections of papers that we administer. The fourth table, Trans, is a table of movements: selling and buying of stocks in the portfolio. In this table a purchase date of January 1 can also indicate a transfer from last year’s account. The field P_number is not used in this assignment.
Develop an application that contains at least this functionality:
The user should be able to choose a portfolio from the name (PortfID). After a portfolio is chosen it is shown, with a list of the stocks in the portfolio, with current value for every stock. In addition the total value of the portfolio is shown.
In order to give the user the possibility to work with some of the portfolio data in Excel a special extraction program shall be written. The user should again be able to choose a portfolio. For this portfolio all sell transactions (in Trans) should be shown. The data is transferred to a spreadsheet, shown with dates and calculated values. Besides the data from the database there should also be a column that shows the annual rate of return (interest) for the individual sells (sic!) in the portfolio (per individual line in Trans). Consider the Excel function XIRR.
Note that the number of stocks sold is the number in the S_number column. And note that if the stock is not shown purchased during the year, it must have been in the January 1 inventory, and the purchase price taken from there. The interesting lines are those where s_number > 0.
himstregimst serendipidity abstrus abderitisk elizabeth berlingske burlesque Burham concupiscence concordatum distributive exclosure gusset incarnative in intinction intervenient jun27: impediment clarify typewriter junebug