代做BUSAN 201 Design Assignment调试Haskell程序

TASK A and TASK B

Assumptions – Task A:

1. Each Service is assigned exactly one Bus and one Driver.

2. A Bus can be used for multiple Services, but not at the same time.

3. A Driver can operate multiple Services on different dates or time slots, but only one at a time.

4. Each Route passes through multiple Stops, and each Stop can belong to multiple Routes.

5. The order of Stops in a Route is maintained using a SequenceOrder attribute in RouteStop.

6. Each Bus belongs to exactly one Depot.

7. A Bus may support multiple fuel types; this is modeled using the BusFuelType table.

8. Each Payslip is generated monthly for a single Driver.

9. Each Accident is linked to exactly one Service and may have multiple Repairs.

10. Depot amenities are stored as a comma-separated list (not normalized).

Assumptions – Task B (Contractor Extension):

1. ContractorDrivers are modeled in a separate table from full-time Drivers to distinguish their employment type.

2. Each ContractorDriver is affiliated with exactly one Agency.

3. ContractorDrivers receive Payslips similar to full-time Drivers, with DailyRate and DistanceRate used instead of HourlyWage.

4. Either DriverID or ContractorID is filled in the Payslip table, but not both.

5. ContractorDrivers are not required to undergo safety training or medical checkups.

TASK C

Analysis 1: Bus Maintenance Records in May 2025 (City Depot)

To determine which buses from the “City” depot underwent maintenance in May 2025, the following ERD-based procedure is used:

1. Use the Depot table to identify the DepotID for the depot with Location or Name = “City”.

→ In our data, "City" corresponds to DepotID = 1.

2. Use the Bus table to find all buses where DepotID matches the City depot, where DepotID = 1.

→ This includes BusID: 101, 102, and 104.

3. Use the Maintenance table to select records where the BusID belongs to one of those buses and the MaintenanceDate falls within May 2025. The following maintenance records meet the condition:

BusID 101 → Maintenance on 2025-05-10 and 2025-05-30

BusID 102 → Maintenance on 2025-05-20

BusID 104 → Maintenance on 2025-06-05 (excluded as not in May)

Therefore, the buses from the City depot that had maintenance in May 2025 are: Bus 101 and Bus 102, with three maintenance activities in total.

Entry Sets Used: Depot, Bus, Maintenance

Sample Data: We generated at least five records for each of these tables, linking Depot, Bus, and Maintenance accordingly.

In conclusion, based on the ERD, this method allows a manager to identify all maintenance activities for the current month within a specific depot.

Analysis 2: Accident Frequency and Repair Cost by Route

To evaluate which route has the highest number of accidents and the associated repair cost, we follow these steps based on the ERD:

1. From the Route table, retrieve all RouteIDs.

In our data, we have RouteID 301 (Route R1) and 302 (Route R2).

2. Use the Service table to find all services assigned to each Route.

→ Route 301 has ServiceIDs 401, 402, 405; Route 302 has ServiceIDs 403, 404.

3. Use the Accident table to count how many accidents occurred for each Service.

→ Service 401: 2 accidents (AccidentID 501, 504)

→ Service 402: 1 accident (AccidentID 502)

→ Service 403: 1 accident (AccidentID 505)

→ Service 404: 1 accident (AccidentID 503)

4. Use the Repair table to calculate the total cost of repairs associated with those accidents.

→ Repairs for R1: $500 (501) + $1200 (502) + $450 (504) = $2150

→ Repairs for R2: $600 (505) + $300 (503) = $900

By grouping the accidents by Route and aggregating the count and repair costs, we can determine which route is most incident-prone and its financial impact.

Entity Sets Used: Route, Service, Accident, Repair

Sample Data: We generated at least five records for each table to reflect meaningful relationships like multiple services per route, accidents per service, and repairs per accident.

In conclusion, based on the sample data, Route 301 had the highest number of accidents (3 total) and accumulated a total repair cost of $2,150. This suggests that Route R1 may require further investigation or additional safety measures.

TASK D

Five methods of controlling data integrity for the Bus relation

1. Entities' Integrity

BusID, the primary key, must be unique and not NULL.

This ensures that each bus record has a unique identity.

2. Domain Integrity

The NumberOfSeats attribute requires a positive value.

For example, a constraint such as CHECK (NumberOfSeats > 0) ensures realistic data entry.

3. Reference Integrity

DepotID is a foreign key in the Bus table that refers to the Depot database.

The Depot. DepotID must be the value of the DepotID field.

4. Honour as defined by the user

To enforce CHECK (FuelType IN ('Diesel', 'Electric', 'Hybrid')), the FuelType in the BusFuelType database must be one of the three designated, allowed values: 'Diesel', 'Electric', or 'Hybrid'

5. Integrity of Transactions

When adding a new maintenance record for a bus, the transaction should include the bus's status update as well as the maintenance data. This guarantees the system state's atomicity and consistency.

TASK E

The new ER model lists drivers and payments in the Driver and Payslip tables. If HR or management often generates pay reports with driver names, influencing performance, the system must integrate the two databases.

1. Normalised Table Structure – Fully Normalised (3NF)

The Driver database includes driver data, whereas the Payslip table contains normalised pay cheque data. Foreign key DriverID connects these tables. This split saves data duplication and quickly updates future joins for driver name changes.

2.  Denormalised Table Structure – With Redundant Data

DriverName appears in denormalised Payslip tables immediately. This field transfers drivers' names from Driver databases to payslips. Reporting without a join saves time but may produce data inconsistencies if the driver's name changes.

Pros

1. Improved Query Performance

Reduces JOIN operations when generating payroll reports.

2. Simplified Report Generation

Makes it easier to retrieve and export payslip data with names.

3. Historical Data Stability

Retains the driver’s name as it was at the time of payment, even if it changes later.

Cons

1. Data Redundancy

Driver name is stored in multiple locations, which violates 3NF.

2. Storage Usage

For large batches of records, redundant text fields will increase the storage volume.


热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图