%Inicio
soat=struct('matricula','ABC123','servicio','particular','clase','auto','anio',5);
n=0;
opc=1;
while opc<=3
disp('1 Registro de vehiculos');
disp('2 Costo del seguro');
disp('3 Salir');
opc=input('Ingrese opcion');
switch(opc);
case 1
n=n+1;
soat(n).matricula=input('Ingrese matricula');
soat(n).servicio=input('Ingrese tipo de servicio');
soat(n).clase=input('Ingrese clase de vehiculo');
soat(n).anio=input('Ingrese anio de antiguedad');
case 2
CS=0;
for i=1:n
if strcmp(soat(i).servicio,'particular')==0
CS=CS+20;
else if strcmp(soat(i).servicio,'publico')==0
CS=CS+50;
end
end
if strcmp(soat(i).clase,'auto')==0
CS=CS+20;
else if strcmp(soat(i).clase,'camioneta')==0
CS=CS+30;
else if strcmp(soat(i).clase,'transporte pasajeros')==0
CS=CS+40;
end
end
end
if soat(i).anio>=1|soat(i).anio<=5
CS=CS+5;
else if soat(i).anio>=6|soat(i).anio<10
CS=CS+10;
else if soat(i).anio>10
CS=CS+20;
end
end
end
end
disp('El costo del soat es');
disp(CS);
case 3
break
end
end