HW7 #3

# HW7 #3 - disp('The net increase in the worth of the...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 %Engineering 6, Spring 2004, Problem 7.3 %Ryan Uy, 2509 %Section B05, Tues. 3-4 price = [19, 16, 26, 21, 27, 19, 17, 21, 27, 31, 19, 22] % (a) disp('(a)') buy = find(price<20) spent = sum(100*price(buy)) disp('The total amount spent in buying shares is:') % (b) disp('(b)') sell = find(price>25) recieved = sum(100*price(sell)) disp('The total amount recieved from selling shares is:') % (c) disp('(c)') total_shares = 1000 - length(buy)*100 + length(sell)*100 disp('The total number of shares owned after the 12th day is:') % (d) disp('(d)') net_increase = price(12)*total_shares - price(1)*1000

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: disp('The net increase in the worth of the portfolio is:') Sheet1 Page 2 %declare price variable %condition for buying shares: price is less than 20 %calculate price of bought shares disp(spent) %condition for selling shares: price is greater than 20 %calculate price of sold shares disp(recieved) %total shares = original # of shares - shares bought - shares sold disp(total_shares) %net increase is defined as the total value of shares owned at end of 12th day disp(net_increase)...
View Full Document

## This note was uploaded on 01/22/2011 for the course ENG 006 taught by Professor Lagerstrom during the Spring '06 term at UC Davis.

### Page1 / 2

HW7 #3 - disp('The net increase in the worth of the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online