Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc
- clear
- % Filename: Rivera13p1
- % Jeremy Rivera
- % EGR 120-001
- % User inputs the tire pressure of all 4 tires, program calculates
- % individual tire pressures, limitations of pressure, and average pressure in psi
- % VARIABLE DECLARATION
- % tirepsi1 (real) user input tire pressure in psi for 1st tire
- % tirepsi2 (real) user input tire pressure in psi for 2nd tire
- % tirepsi3 (real) user input tire pressure in psi for 3rd tire
- % tirepsi4 (real) user input tire pressure in psi for 4th tire
- % avgtirepsi (real) user input all tire pressures and gets average pressure in psi
- tirepsi1=input ('Input your first tire pressure in psi: ');
- tirepsi2=input ('Input your second tire pressure in psi: ');
- tirepsi3=input ('Input your third tire pressure in psi: ');
- tirepsi4=input ('Input your fourth tire pressure in psi: ');
- avgtirepsi=(tirepsi1+tirepsi2+tirepsi3+tirepsi4)/4;
- if (tirepsi1<28)
- fprintf('Tire 1 needs more pressure\n');
- else
- fprintf('Tire 1 pressure is optimal\n');
- end
- if (tirepsi2<28)
- fprintf('Tire 2 needs more pressure\n');
- else
- fprintf('Tire 2 pressure is optimal\n');
- end
- if (tirepsi3<28)
- fprintf('Tire 3 needs more pressure\n');
- else
- fprintf('Tire 3 pressure is optimal\n');
- end
- if (tirepsi4<28)
- fprintf('Tire 4 needs more pressure\n');
- else
- fprintf('Tire 4 pressure is optimal\n');
- end
- if (avgtirepsi<30)
- fprintf('Suggestion to check the pressure & and add to bare minimum of 30 psi\n');
- else
- fprintf('Your average tire pressure in psi is: %0.3f\n',avgtirepsi);
- end
Add Comment
Please, Sign In to add comment