|
查看: 844|回复: 1
|
MATLAB Group Assignment
[复制链接]
|
|
|
MATLABGroup Assignment
Problem:-
Todetermine the types of accidents in five different states, and the total numberover a period of one month.
no. ofaccidents
Selangor –A1
NegeriSembilan – A2
Perak – A3
Johor – A4
Penang – A5
Dividedinto two types of accidents per state:-
i)
Highways
ii)
Normal roads
For eachtype of road, three different categories:-
i)
Cars
ii)
Motorcycles
iii)
Lorries
Fatalitiesfor each category:-
i)
Yes or no
请各位江湖中人帮助小弟,因为小弟的讲师并没有解释给我们,加上我们又看不懂notes,而且是突然间学matlab(原本是visual basic)...
pls help me....tqtqtq |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 12-10-2008 10:01 PM
|
显示全部楼层
i finish it by myself already...any suggestion...? thanks...pls help me to correct it..and make it better..thanks all shifu and seniorss
input('Welcome to the accidents calculating program, to continue please press ENTER')
input('Selangor');
input('Press ENTER to key in the number of accidents');
a=input('Number of accidents :');
input('Press ENTER to key in the number of accidents by following the type of roads');
b=input('Highways :');
c=input('Normal roads :');
input('Press ENTER to key in the number of accidents by following the type of transports');
d=input('Cars :');
e=input('Motocycles :');
f=input('Lorries :');
input('Press ENTER to key in the number of fatality accidents');
g=input('Fatalities :');
input('Press ENTER to continue');
input('Negeri Sembilan');
input('Press ENTER to key in the number of accidents');
h=input('Number of accidents :');
input('Press ENTER to key in the number of accidents by following the type of roads');
i=input('Highways :');
j=input('Normal roads :');
input('Press ENTER to key in the number of accidents by following the type of transports');
k=input('Cars :');
l=input('Motocycles :');
m=input('Lorries :');
input('Press ENTER to key in the number of fatality accidents');
n=input('Fatalities :');
input('Press ENTER to continue');
input('Perak');
input('Press ENTER to key in the number of accidents');
o=input('Number of accidents :');
input('Press ENTER to key in the number of accidents by following the type of roads');
p=input('Highways :');
q=input('Normal roads :');
input('Press ENTER to key in the number of accidents by following the type of transports');
r=input('Cars :');
s=input('Motocycles :');
t=input('Lorries :');
input('Press ENTER to key in the number of fatality accidents');
u=input('Fatalities :');
input('Press ENTER to continue');
input('Johor');
input('Press ENTER to key in the number of accidents');
v=input('Number of accidents :');
input('Press ENTER to key in the number of accidents by following the type of roads');
w=input('Highways :');
x=input('Normal roads :');
input('Press ENTER to key in the number of accidents by following the type of transports');
y=input('Cars :');
z=input('Motocycles :');
A=input('Lorries :');
input('Press ENTER to key in the number of fatality accidents');
B=input('Fatalities :');
input('Press ENTER to continue');
input('Pulau Pinang');
input('Press ENTER to key in the number of accidents');
C=input('Number of accidents :');
input('Press ENTER to key in the number of accidents by following the type of roads');
D=input('Highways :');
E=input('Normal roads :');
input('Press ENTER to key in the number of accidents by following the type of transports');
F=input('Cars :');
G=input('Motocycles :');
H=input('Lorries :');
input('Press ENTER to key in the number of fatality accidents');
I=input('Fatalities :');
input('Press ENTER to continue');
input ('SELANGOR')
Total_number_of_accidents = a
The_rates_of_accidents_that_happened_on_highways = (b/a)*100
The_rates_of_accidents_that_happened_on_normal_roads = (c/a)*100
The_rates_of_accidents_that_caused_by_cars = (d/a)*100
The_rates_of_accidents_that_caused_by_motorcycles = (e/a)*100
The_rates_of_accidents_that_caused_by_lorries = (f/a)*100
The_rates_of_fatality_accidents = (g/a)*100
input('Press ENTER to continue');
input ('NEGERI SEMBILAN')
Total_number_of_accidents = h
The_rates_of_accidents_that_happened_on_highways = (i/h)*100
The_rates_of_accidents_that_happened_on_normal_roads = (j/h)*100
The_rates_of_accidents_that_caused_by_cars = (k/h)*100
The_rates_of_accidents_that_caused_by_motorcycles = (l/h)*100
The_rates_of_accidents_that_caused_by_lorries = (m/h)*100
The_rates_of_fatality_accidents = (n/h)*100
input('Press ENTER to continue');
input ('PERAK')
Total_number_of_accidents = o
The_rates_of_accidents_that_happened_on_highways = (p/o)*100
The_rates_of_accidents_that_happened_on_normal_roads = (q/o)*100
The_rates_of_accidents_that_caused_by_cars = (r/o)*100
The_rates_of_accidents_that_caused_by_motorcycles = (s/o)*100
The_rates_of_accidents_that_caused_by_lorries = (t/o)*100
The_rates_of_fatality_accidents = (u/o)*100
input('Press ENTER to continue');
input ('JOHOR')
Total_number_of_accidents = v
The_rates_of_accidents_that_happened_on_highways = (w/v)*100
The_rates_of_accidents_that_happened_on_normal_roads = (x/v)*100
The_rates_of_accidents_that_caused_by_cars = (y/v)*100
The_rates_of_accidents_that_caused_by_motorcycles = (z/v)*100
The_rates_of_accidents_that_caused_by_lorries = (A/v)*100
The_rates_of_fatality_accidents = (B/v)*100
input('Press ENTER to continue');
input ('PULAU PINANG')
Total_number_of_accidents = C
The_rates_of_accidents_that_happened_on_highways = (D/C)*100
The_rates_of_accidents_that_happened_on_normal_roads = (E/C)*100
The_rates_of_accidents_that_caused_by_cars = (F/C)*100
The_rates_of_accidents_that_caused_by_motorcycles = (G/C)*100
The_rates_of_accidents_that_caused_by_lorries = (H/C)*100
The_rates_of_fatality_accidents = (I/C)*100
input('Press ENTER to continue');
Total_number_of_accidents_in_five_states = a+h+o+v+C
Total_rates_of_accidents_on_highways_in_five_states = ((b+i+p+w+D)/(a+h+o+v+C))*100
Total_rates_of_accidents_on_normal_roads_in_five_states = ((c+j+q+x+E)/(a+h+o+v+C))*100
Total_rates_of_accidents_caused_by_cars_in_five_states = ((d+k+r+y+F)/(a+h+o+v+C))*100
Total_rates_of_accidents_caused_by_motorcycles_in_five_states = ((e+l+s+z+G)/(a+h+o+v+C))*100
Total_rates_of_accidents_caused_by_lorries_in_five_states = ((f+m+t+A+H)/(a+h+o+v+C))*100
Total_rates_of_fatality_accidents_in_five_states = ((g+n+u+B+I)/(a+h+o+v+C))*100
[ 本帖最后由 JF2008 于 15-10-2008 01:34 AM 编辑 ] |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|