• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

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

See related essaysSee related essays

Related GCSE T-Total essays

  1. T-Shapes Coursework

    This means I predict that with a wxl "T" on a width g grid, the sum will always be wn + 1/2 l {2n + g(l + 1)}. 6) Testing My formula works as shown with the following, previously unused values: 1)

  2. Maths Coursework T-Totals

    we must now try it on another grid size with another type of a combination translation, to verify that it is correct, I have chosen a grid width of 5, extended vertically to accommodate the combination translation: 1 2 3 4 5 6 7 8 9 10 11 12 13

  1. Maths coursework

    t-shape for N14 is in grid one and the t-shape for N16 is in grid two. T in grid 1 = 28 T in grid 2 = 38 Here it shows that (2/0) is 10 more than (0/0). Therefore the formula here is T2 = 5N - 7G + 10

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

    Testing my Pattern formula. I will test my formula to see if it is producing the same values as in Table 1. N=1, B= 4(1) + 6 = 10. N=2, B= 4(2) + 6 = 14. N=3, B= 4(3) + 6 = 18.

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

    Similar to the split rate model, a split value is needed which determines the value at which the pricing will change. Also, similar to the split rate model, the price after the split value is usually less than before it.

  2. ICT system analysis and modelling.

    It did not contain formulas or anything else it was left plain and simple. Draft 2 was a little more harder as it contained formulas and equations and sums.

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