You are on page 1of 2

CSC 211 Data Structures Due Date 16th Oct, 2011

Instructions:

Problem Set 2 Instructor : Raza

   

This is an individual assignment Negative marking in case of copying from any place There are marks for following good programming convention. Follow the emailing conventions( Email subject should be CSC211-PS2)

Question 1 Suppose that you are hired by a bank to make software for their credit card department. As a part of the requirements, you have to Store the information of user like Name of the user, credit card transaction limit, credit card spending in the current month and number of transactions in the current month, the money that can be spent in the current month. Furthermore, you will also be required to store the total value of the transactions made from the start of the year. Create a linklist of “x” users, where x is a number entered by the user Make the functions like 1. Credit function : Credit function would result in a transaction of ABC amount on the XYZ user. Credit function is like taking some loan from the bank and after credit the amount that can be spent would decrease. Let us suppose that a user John has got transaction limit of 50,000. Credit card spending in the current month are zero and number of transactions in the current month are zero. The user can still spend 50,000 in current month using his credit card.Now suppose that John spends 20,000 in one transaction using the credit card. So the result will Credit card spending=20,000 Rs The amount that can be spent in the current month=50,000-20,000=30,000 No of Credit Card Transactions in current month = 1 2. Pay function: Pay function will result in payment of the “M” amount for the user U”. Pay Function is like paying the money owed to the bank. Considering the example in the last part i.e. 1 The user owes 20,000 to the bank User = John Amount owed=20,000 Amount that still can be spent=30,000 Now let us suppose that John pays 20,000 to the bank then the result would be User = John

Total number of transactions on the credit card in an year: This function will return the total number of transactions in an year for a particular user 5. The recommendation will be based on the average spending from the start of the year 8. Your function may have an input argument specifying the conversion rate. 6. PrintAll . Value of Credit card transactions in the current month: This function will return the total value of the transactions ( in Rs )in the current month for a particular user. Information about passive users: This function will return the list of all the users who have not made any transaction from the start of the year 9. 7.Amount owed=0000 Amount that still can be spent=50. Information about all the users with non negative balance: This function will return the information about all the users who owe some money to the bank or in other words have a pending balance. Let us suppose that bank charges 1% on every transaction. Pop 3. Question 2 Make a program to demonstrate the working of a stack using arrays. Your program should demonstrate the following functions 1 Push 2.000 3. Recommendation : Recommendation function would analyze the list of all the users and recommend some users for the increase in credit card spending limit. MinMax: Make a function to print the information of the user who has spent the most and the user who has spent the least 11. In other words this function would print information about all the users who have to pay some money to the bank. Make a menu to demonstrate the working of these functions in a main program. Search 4. Make a function to calculate this profit 10. then what is the profit earned by the bank from the start of the year. Total value of spending ( in Rs )on the credit card in an year: This function will return the total value of the spending in an year for a particular user 4. Make a function to convert the profit of the bank into any other currency.