Do the flowchart of that program
name = input('Enter the name: ','s');
n=input('\n Enter number of rented cars: ');
m=input('\n Enter car type \n1:SEDAN 2:SUV ');
nm = input('\n Enter number of miles travelled: ');
d = input('\n Enter number of days: ');
if m==1
if (1<=d)&&(d<=6)&&nm<=80
tpay_sed = 79*n*d;
elseif (1<=d)&&(d<=6)&&nm>80
em=nm-80;
tpay_sed = 79*n*d + 0.69*em*n;
end
if (7<=d)&&(d<=29)&&nm<=100
tpay_sed = 69*n*d;
elseif (7<=d)&&(d<=29)&&nm>100
em=n-100;
tpay_sed = 69*n*d + 0.59*em*n;
end
if (30<=d)&&nm<=120
tpay_sed = 59*n*d;
elseif (30<=d)&&nm>120
em=nm-120;
tpay_sed = 59*n*d + 0.49*em*n;
end
fprintf('\n%s(SEDAN)\nNo of Days:%d\nExtra Miles:%d\nTotal Pay:%f\n',name,d,em,tpay_sed);
end
if m==2
if (1<=d)&&(d<=6)&&nm<=80
tpay_suv = 84*n*d;
elseif (1<=d)&&(d<=6)&&nm>80
em=nm-80;
tpay_suv = 84*n*d + 0.74*em*n;
end
if (7<=d)&&(d<=29)&&nm<=100
tpay_suv = 74*n*d;
elseif (7<=d)&&(d<=29)&&nm>100
em=nm-100;
tpay_suv = 74*n*d + 0.64*em*n;
end
if (30<=d)&&nm<=120
tpay_suv = 64*n*d;
elseif (30<=d)&&nm>120
em=nm-120;
tpay_suv = 64*n*d + 0.54*em*n;
end
fprintf('\n%s(SUV)\nNo of Days:%d\nExtra Miles:%d\nTotal Pay:%f\n',name,d,em,tpay_suv);
end
if you have any doubt please comment below
Get Answers For Free
Most questions answered within 1 hours.