• Join over 1.2 million students every month
• Accelerate your learning by 29%
• Unlimited access from just £6.99 per month
Page
1. 1
1
2. 2
2
3. 3
3
4. 4
4
5. 5
5
6. 6
6
7. 7
7
• Level: GCSE
• Subject: Maths
• Word count: 1166

# Modelling Motorway Toll Charging

Extracts from this document...

Introduction

Computer Science 111 Third Coursework Problem Motorway Toll Charging Problem The M111 is a newly opened toll motorway, with eight junctions at which the entry and exit of vehicles from the M111 is monitored. I must design and implement a program that can read the tolls data from a file and process the information to produce a table of users for that week and a summary. Form of Data Input tollsinfo file input Gravelly L123ABC J 23 15 30 Ashton ABN1123 J 11 0 56 . . . . . . . . . . . . . . . . . . . . . . . . Fratton L123ABC L 1 12 31 Form of Data Output (Results) Registration trips in wk tolls due speeding violations total due Number serious dangerous _______________________________________________________________ L123ABC 7 11.76 1 0 31.76 ***********************Summary*********************** Total revenue for week was �1129.23 Total number of different users was 24 Total number of peak journeys was 45 Total off peak journeys was 65 Total number of serious speeding was 11 Total number of dangerous speeding was 8 Top Level Design While not end ...read more.

Middle

Temp.Status ='J' THEN Owner_Record(position).junction:=Temp.junction; Owner_Record(position).Hour:=Temp.Hour; Owner_Record(position).minute:=Temp.minute; Owner_Record(position).second:=Temp.second; ELSE D_Distance; Time(Total_Seconds=>T_seconds); Increment_Values(Time=>T_Seconds); END IF; D1 PROCEDURE D_Distance X,Y:Character; Temp,Arrive,Leave,leave1:Integer; TYPE Distance IS ARRAY(1..7) OF Float; Miles:CONSTANT Distance:=(1=>8.5, 2=>6.9, 3=>8.3, 4=>6.0, 5=>5.5, 6=>3.2, 7=>11.6); -- array constant used to set values to permenant distances O_Distance:=0.0; X:=Owner_Record(position).Junction; Y:=Temp.Junction; Use case to assign arrive and leave value from 1to 7 iF Arrive>leave THEN Temp:=leave; leave:=arrive; arrive:=Temp; END IF; Leave1:=Leave-1; FOR index in Arrive..Leave1 DO O_Distance:=O_Distance+miles(index); END D2 PROCEDURE Time (Total_Seconds:out Integer) Join : Integer:=0; Leave : Integer:=0; SecsInDay : CONSTANT Integer := 24 * 60 * 60; -- calculates the total seconds in a day BEGIN Total_Seconds:=0; Join := (Owner_Record(Position).hour * 3600) + (Owner_Record(Position).minute * 60) + Owner_Record(Position).second; Leave :=(temp.hour * 3600) + (temp.minute * 60) + temp.second; IF Owner_Record(Position).hour < Temp.hour THEN Total_seconds := Leave - Join; ELSIF Owner_Record(Position).hour = Temp.hour THEN IF Owner_Record(Position).minute < Temp.minute THEN Total_seconds := Leave - Join; ELSIF Owner_Record(Position).minute = Temp.minute THEN IF Owner_Record(Position).second < Temp.second THEN Total_seconds := Leave - Join; ELSE Total_seconds := Leave + SecsInDay - Join; END IF; ELSE Total_Seconds := Leave + SecsInDay - Join; END IF; ELSE Total_seconds := Leave + SecsInDay - Join; END IF; D3 PROCEDURE Increment_Values(Time:IN Integer) ...read more.

Conclusion

reg_array is a type I defined to hold the users registration number. This could be anything up to seven characters. Because when reading the file it only reads a character at a time the whole registration could not be read as one string. Reading in character-by-character an array of string is used to store this. type car_owner_details is RECORD Junction:character; reg:Reg_Array:=" "; Status:character; Hour:Integer:=0; Minute:Integer:=0; Second:Integer:=0; Trips_In_wk:Integer:=0 Tolls_due:float:=0.0; Serious:Integer:=0; Dangerous:Integer:=0; Total_owner:float:=0.0; end record Car_owner_details is a record containing 11 fields that make up the data needed for each different user. By defining my own record type I can choose what to store in the fields and of what type. type records is array (0..1000) of records To be able to hold a 1000 different users details 1000 records are needed. This is why an array of car_own_details is needed. To do this I defined type records, which is an array of 1000 of the record type (owner_record). Temp_record and Owner_records are types defined by me to act as variables of the entire record structure. In other words they allow me to pass around all the fields in car_owner_details. ...read more.

The above preview is unformatted text

This student written piece of work is one of many that can be found in our GCSE T-Total section.

## Found what you're looking for?

• Start learning 29% faster today
• 150,000+ documents available
• Just £6.99 a month

Not the one? Search for your essay title...
• Join over 1.2 million students every month
• Accelerate your learning by 29%
• Unlimited access from just £6.99 per month

# Related GCSE T-Total essays

1. ## T-Shapes Coursework

Where n = 177, w = 23, l = 14, g = 40 Total Sum = = = = Total Sum = = = = = = Wing + Tail [166 + ... 175 + 176 + 177 + 178 + 179 + ...

2. ## T-Shapes Coursework

51 52 53 54 55 56 57 58 59 60 61 62 63 64 The table above shows our T-Shape being rotated 180�. T-Number of rotated T-Shape: 36 T-Total of rotated T-Shape: 36 + 44 + 51 + 52 + 53 = 236 So let us try the general formula we have just discovered: Tt =5 x 36 + 7(8)

1. ## Maths Coursework T-Totals

+3 or -2) and g is the grid width. Horizontal Again, we shall use our standard gird size and position to establish our basic starting point; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

2. ## Maths coursework

that I predicted is correct, this is because when I used the predicted formula the answer I got to was 55 and when I used addition the answer I got was the same of 55. However if you look at G10 in grid 11 when N = 25 there is a relationship between T, N and G.

1. ## I am going to investigate how changing the number of tiles at the centre ...

Each pattern number is counted as N and the squares in that outer most border is counted as B. These numbers change as each outer border gets bigger. Every pattern number with only centre tiles has no border, so it has not been included in the sequence to make my formulae.

2. ## For this task we were required to create a model that can be used ...

The split rate is applied to the daily units. This is probably because the majority of the units are used in the daytime. Economy 7 split rate works the same as the normal economy 7 because a period of time is still needed for the user's night, and the day and night values are still worked separately.

• Over 160,000 pieces
of student written work
• Annotated by
experienced teachers
• Ideas and feedback to