clc
disp('Enter the required information for the fisrt alternative ')
IntialCostFA=input('Enter the intial cost for the first alternative : ');
UACFA=input('Enter the uniform annual cost for the first alternative : ');
UABFA=input('Enter the uniform annual benefit for the first alternative : ');
SalFA=input('Enter the salvage value for the first alternative : ');
UseLifeFA=input('Enter the useful life for the first alternative : ');
disp('Enter the required information for the second alternative ')
IntialCostSA=input('Enter the intial cost for the second alternative : ');
UACSA=input('Enter the uniform annual cost for the second alternative : ');
UABSA=input('Enter the uniform annual benefit for the second alternative : ');
SalFSA=input('Enter the salvage value for the second alternative : ');
UseLifeSA=input('Enter the useful life for the second alternative : ');
r=input('Enter the MARR: ');
n1=UseLifeFA;
n2=UseLifeSA;
a=(((1+r)^n2)-1)/(r*((1+r)^n2));
CapRec1=UACFA*a;
PR1=(IntialCostFA-SalFA)*(1+r)^n1;
PWC1=IntialCostFA+CapRec1+PR1;
CapRec2=UABFA*a;
PR2=SalFA*(1+r)^n2;
PWB1=CapRec2+PR2