Finally, I built a program for calculating the checks we have to write to eachother to pay the rent each month! Matlab, of course.
% Calculates rent for 3 peoples
clear all;
close all;
rents = 750; % Andrew pays that to the landlady
gas = input('How much was gas this time?'); % Rajay pays that
comcast = input('How much was Comcast this time?'); % Themo pays that
power = input('How much was power and water this time?'); % Rajay pays that
andrew_from_themo = rents;
andrew_from_rajay = rents;
rajay_from_andrew = (power+gas)/3;
rajay_from_themo = (power+gas)/3;
themo_from_andrew = comcast/3;
themo_from_rajay = comcast/3;
andrew_from_themo2 = andrew_from_themo - themo_from_andrew;
rajay_from_themo2 = rajay_from_themo - themo_from_rajay;
andrew_from_rajay2 = andrew_from_rajay - rajay_from_andrew;
andrew_from_themo3 = andrew_from_themo2 + rajay_from_themo2;
andrew_from_rajay3 = andrew_from_rajay2 - rajay_from_themo2;
disp(['Rajay, you pay $',num2str(andrew_from_rajay3),' to Andrew. Sucker!']);
disp(['Themo, you pay $',num2str(andrew_from_themo3),' to Andrew.']);
Monday, January 23, 2006
Categories
- Apple (41)
- Art (2)
- Astronomy (2)
- Books (1)
- Conferences (35)
- cool (30)
- Explanations (1)
- Favorites (39)
- Flight Blogs (8)
- food (4)
- geeky (71)
- Greece (19)
- greeks (20)
- hdr (6)
- hdr london (1)
- internet (2)
- iPhone (3)
- kids (2)
- Las Vegas (11)
- life (143)
- London (22)
- Los Angeles (40)
- Lost (37)
- matlab (1)
- Maui (5)
- Miami and The Bahamas (11)
- Movies (109)
- nature (1)
- New York (39)
- New York Guide (10)
- phd (14)
- Photography (2)
- Physics (1)
- Plasma Road Trip (10)
- Podcast (6)
- science (39)
- shows (17)
- TED (4)
- trips (102)
- United Kingdom (5)
- USA (7)
- usc (3)
- Vista (9)
- weather (1)
- wedding (3)
- ΕΜΠ (1)