You are on page 1of 1

Introduction to .

Net programming

Exercises List 2

1. In this exercise, you will take the bank account struct that you developed (exercises 1 and

2.

3.

4.

5.

2 in exercises list 1) and convert it into a class. You will declare its data members as private but provide non-static public methods for accessing the data. You will build a test harness that creates an account object and populates it with an account number and balance that is specified by the user. Finally, you will print the data in the account. In this exercise, you will modify the BankAccount class from Exercise 1 so that it will generate unique account numbers. You will accomplish this by using a static variable in the BankAccount class and a method which increments and returns the value of this variable. When the test harness creates a new account, it will call this method to generate the account number. It will then call the method of the BankAccount class that sets the number for the account, passing in this value as a parameter. In this exercise, you will add two methods to the Account class: Withdraw and Deposit. Withdraw will take a decimal parameter and will deduct the given amount from the balance. However, it will check first to ensure that sufficient funds are available, since accounts are not allowed to become overdrawn. It will return a bool value indicating whether the withdrawal was successful. Deposit will also take a decimal parameter whose value it will add to the balance in the account. It will return the new value of the balance. In this exercise, you will write a program that uses arrays to multiply matrices together. The program will read four integer values from the console and store them in a 2 x 2 integer matrix. It will then read another four integer values from the console and store them in a second 2 x 2 integer matrix. The program will then multiply the two matrices together, storing the result in a third 2 x 2 integer matrix. Finally, it will print the resulting matrix to the console. Generalize this program to multiply n*n matrices

You might also like