PART 2 (Lab)                                                                                                          

Write a matlab program for a bank account. Item data should be stored in three parallel 1D arrays (user_ID, current, saving). The first contains the ID of the customers, the second contains the amount of the money in the current account and the third contains the amount of the money in the saving account. You must use the function declaration given.

Write a function, called readthat readsthe bank’s information. (size is user input “from main” that defines the size of the array)

function [user_ID, current, saving] = read (size);

Create the function totalMoney for each customer (i.e., current+ saving) and store them in the array. (The summation must be calculated by using a loop)

function [total] = totalMoney (size, current, saving);

Create a function status_customerthat indicates the status of the customers where the array contains “1s” and “0s”. The “1s” should be written for the twocustomers of the toptotals and “0s” for the others. Hint: You have to find the 2 largest (max) totals.

function [status] = status_customer (size, total);

Create a function print1that prints the information.  

function [] = print1(size, user_ID, current, saving, total, status);

Create a function sort_arraysthat sort all the arrays in descending order based on the total.

function [user_ID, current, saving, total, status] = sort_arrays (size, user_ID, current, saving, total, status );

The output of your program might look similar to the example below: (Printing before and after sorting)

Username   Current Saving  Total  Status

101        100      150      250   0

102        250      300      550   1

103        300      350     650    1

104        120      140      260   0

NewUsername   NewCurrent   NewSaving   NewTotal      NewStatus

103            300           350         650        1

102            250           300        550          1

104            120           140         260        0

101            100           150         250        0                                   

"Get 15% discount on your first 3 orders with us"
Use the following coupon
"FIRST15"

Order Now