Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Other

COS2611 Final Project 2024 solution

Rating
3.7
(3)
Sold
18
Pages
9
Uploaded on
21-09-2024
Written in
2024/2025

COS2611 Final Project 2024 solution Highway traffic flow analyser Final Practical Project - Mark contributes to the final examination mark. Study the scenario that will monitor and analyse traffic patterns to determine if the road can handle the volume or if it requires expansion Follow the instructions to develop, test and submit the project. Click on ADD SUBMISSION to see the details and activity instructions. Highway traffic flow analyser Scenario: Imagine a single-lane road in a suburb of Cape Town that experiences varying traffic flow throughout the day. Over a period of 6 days, traffic engineers need to monitor and analyse these patterns to determine if the road can handle the volume or if it requires expansion. They contacted you, as a student in Computer Science to assist them. 1. Data Collection The traffic department of Cape Town provides you with the data in a text file () - see attached. Typical data in the : Timestamp; Vehicle Type; Speed (km/h) :00:00; Motorbike; 45 :14:23; Bus; 115 2. Your C+++ Console Program Your task is to, using C++, develop a traffic flow analyser that monitors and analyses the flow of cars on a specific stretch of single lane road. The program will read the captured data from the file and, using appropriate methods and functions, analyse trends, calculate averages, identify peak traffic times, and generate a report to assist road planners in making informed decisions about future road development. You may use any of the functions or methods we have studied throughout the year in this project, but you must include comments in your code explaining each step and your reasoning for choosing specific methods or functions. Additionally, you may include documentation within the comments to help the examiner understand your logic and decisions. 3. Choose any three (3) of the following reports to generate Report 1. Traffic Summary Report Total vehicles: The total number of vehicles recorded over the specified period. Vehicle count per day: A breakdown of the number of vehicles passing per day. Vehicle type distribution: The number and percentage of each vehicle type (e.g., cars, buses, bikes). Example output: Traffic Summary Report: ----------------------- Total vehicles: 1200 Day 1: 250 vehicles Day 2: 300 vehicles ... Vehicle distribution: - Cars: 800 (66.67%) - Buses: 100 (8.33%) - Motorbikes: 300 (25.00%) Report 2. Peak Traffic Times Report Hourly peak traffic: Identify the hours with the highest traffic volume. Daily peak traffic: Determine which day had the most traffic. Time intervals with maximum congestion: Specific times where the road was most congested. Example output: Peak Traffic Times Report: -------------------------- Peak traffic time (overall): 17:00 - 18:00 with 150 vehicles Peak traffic by day: - Day 1: 16:00 - 17:00, 45 vehicles - Day 2: 17:00 - 18:00, 60 vehicles ... Report 3. Speed Analysis Report Average speed of vehicles: Display the average speed of vehicles passing over the specified period. Speed ranges: Categorize vehicle speeds (e.g., slow, medium, fast) and report on how many falls into each category. Example output:Speed Analysis Report: ---------------------- Average speed: 55.4 km/h Speed distribution: - Slow (0-30 km/h): 50 vehicles - Medium (30-60 km/h): 600 vehicles - Fast (60+ km/h): 550 vehicles Report 4. Congestion Level Report Congestion trends: Identify periods where traffic flow is significantly higher than average, indicating congestion. Congestion by day/hour: Report on the most congested times of each day and the overall period. Example output: Congestion Level Report: ------------------------ Average congestion level: Moderate Most congested period: Day 3, 17:00 - 18:00, with 80 vehicles Congestion breakdown by day: - Day 1: Low (200 vehicles) - Day 2: High (300 vehicles) ... Report 5. Custom Time Interval Report User-specified time intervals: Allow the user to specify custom time intervals (e.g., "report from 09:00 to 12:00 over 5 days") to generate tailored traffic data. Example output: Custom Interval Report (09:00 to 12:00): ---------------------------------------- Total vehicles: 400 Average speed: 52.3 km/h Most congested time: 11:00 - 12:00, 80 vehicles Report 6. Vehicle Type-Specific Report Traffic trends for specific vehicle types: Provide a report focusing on a particular type of vehicle (e.g., just cars, or buses). Example output: Vehicle Type Report (Buses): ---------------------------- Total buses: 150 Peak time: 18:00 - 19:00, 25 buses Average speed: 40.2 km/h4. Develop, test and compile your C++ code. When you are ready to submit, add your student number and name in the FIRST line of the .cpp as a comment. Any classes and/ or packages that you either develop or import should be part of the .cpp code. The folder for the .txt file should refer to C:data (the examiner will use a different set of data to test your systems). 5.Save your file as yourStudentNumber_FP.cpp, for example, _FP.cpp. Replace with YOUR student number. Upload it on or before the due date. The due date is not the day to start this project; it is the day by which you must submit it. Keep in mind potential issues such as internet problems, load shedding, myUNISA unavailability, etc. Any file that does not include your student details and/or saved with your student number, will NOT BE ASSESSED. 6. The following rubric will be used to assess your three projects and code: Criteria Student Marks Mark Description Report 1 Generation (10 Marks) Correctness of Data Report accurately reflects the correct data and performs correct calculations. 2 Completeness of ReportIncludes all required elements (e.g., totals, peak times, averages).2 Data Presentation and ClarityWell-formatted, easy to read, and presents data clearly.2 Trend AnalysisIdentifies and explains trends (e.g., peak times, congestion).2 Allows customisation and easy interaction for generating reports.2 User Interaction and Customization Report 2 Generation (10 Marks) Correctness of Data Report accurately reflects the correct data and performs correct calculations. 2 Completeness of ReportIncludes all required elements (e.g., totals, peak times, averages).2 Data Presentation and ClarityWell-formatted, easy to read, and presents data clearly.2 Trend AnalysisIdentifies and explains trends (e.g., peak times, congestion).2 Allows customisation and easy interaction for generating reports.2 User Interaction and Customization Report 3 Generation (10 Marks) Correctness of Data Report accurately reflects the correct data and performs correct calculations. 2 Completeness of ReportIncludes all required elements (e.g., totals, peak times, averages).2 Data Presentation and ClarityWell-formatted, easy to read, and presents data clearly.2 Trend AnalysisIdentifies and explains trends (e.g., peak times, congestion).2 User Interaction and CustomizationAllows customisation and easy interaction for generating reports.2 FunctionalityCode functions as expected, generating correct reports without errors.4 Code Structure and ReadabilityWell-organized, follows good practices, and is easy to understand.2 Commenting andWell-commented code with explanations for key decisions andDocumentationmethods used.Error HandlingAppropriate error handling for invalid input, file errors, etc. Coding Quality (10 Marks)

Show more Read less
Institution
Course

Content preview

COS2611 2024 FINAL PROJECT
SOLUTION(100% working)
Crystal Indigo!
Crystal Indigo!
Providing all solutions you need anytime
+27 76 626 8187




Copy and run the code and submit what you are suppose to submit

, OUTPUT




Source Code
// Student Number:
// Name:
#include <vector>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <map>
#include <iomanip>

using namespace std;

// Struct to hold traffic data
struct TrafficData {
string timestamp;
string vehicleType;
int speed;
};

// Function to read traffic data from file
vector<TrafficData> readTrafficData(const string &filePath) {
vector<TrafficData> data;

Written for

Institution
Course

Document information

Uploaded on
September 21, 2024
Number of pages
9
Written in
2024/2025
Type
OTHER
Person
Unknown

Subjects

$11.59
Get access to the full document:
Purchased by 18 students

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Reviews from verified buyers

Showing all 3 reviews
1 year ago

11 months ago

1 year ago

3.7

3 reviews

5
0
4
2
3
1
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
CrystalIndigo University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
486
Member since
5 year
Number of followers
226
Documents
73
Last sold
5 months ago
CrystalIndigo Solutions

providing all solutions to all computer science modules

4.1

51 reviews

5
27
4
13
3
6
2
1
1
4

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions