رد: Matlab .. assaigment L4
هذا حل السؤال الرابع
اتمنى منكم الدعاء لي والله يوفقكم
x=input('please enter "0" for House rate and "1" for company rate : ' ) ;
c=input('please enter the consumption value : ' ) ;
switch x
case 0
switch logical(true)
case c<500
cost=c*3 ;
case c<1500 ;
cost=c*6 ;
case c<2500
cost=c*11 ;
case c<=3000
cost=c*15 ;
case c>3000
cost=c*15 ;
cost=cost+(cost*0.12) ;
end
case 1
switch logical(true)
case c<500
cost=c*7 ;
case c<1500
cost=c*9 ;
case c<2500
cost=c*17 ;
case c<=3000
cost=c*25 ;
case c>3000
cost=c*25 ;
cost=cost+(cost*0.12) ;
end
end
disp('The total invoice is : ')
disp(cost)
|