0% found this document useful (0 votes)
72 views2 pages

Sahyadri College of Engineering & Management, Mangaluru Mini-Project Report

The document is a mini-project report submitted by a student. It details an app that calculates travel time based on distance and mode of transportation. The app takes distance and transportation mode as input, uses functions to calculate time based on speed, and outputs the time taken. Modes included are bike, bus, flight, train, and ship. The student's code for the app is provided, which takes these inputs, runs calculations, and displays the expected output of time taken for the given distance and mode.

Uploaded by

Kartik Naik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views2 pages

Sahyadri College of Engineering & Management, Mangaluru Mini-Project Report

The document is a mini-project report submitted by a student. It details an app that calculates travel time based on distance and mode of transportation. The app takes distance and transportation mode as input, uses functions to calculate time based on speed, and outputs the time taken. Modes included are bike, bus, flight, train, and ship. The student's code for the app is provided, which takes these inputs, runs calculations, and displays the expected output of time taken for the given distance and mode.

Uploaded by

Kartik Naik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Sahyadri College of Engineering & Management, Mangaluru

Department of Information Science & Engineering


Mini-Project Report

Course Title : C and C++ Industry Connect Program Date: 10/10/2018 Sem / Section:3/A
Faculty: Mr. Vijay C P & Mr. Srinath K S
Student Name: Likhith R USN:4SF17CS078

Title: App to calculate time.

Description:

Imagine we have to travel a certain distance and there are different modes of transport. And if you chose any
mode the application will give you the time taken by that type of transport to cover the distance.

Input Format:

The First line represents the distance to be covered in kilometres.


The second line is option from the menu provided.
The menu consists of List of different vehicles such as Bike, Car, Bus, Train, & Flight.

Input: 350
3

Expected Output:

The time taken to travel by (option 3) is 0.429975 hours

Source Code:

//Authors: Likhith R
//Date: 26/10/2018
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef int I;
typedef char C;
typedef float F;
I mode;
I distance;
F time(F speed) //function calculating time
{
F time_required;
time_required=distance/speed; //calculates time
return time_required; //returns time to main
}
void main()
{
F tim;
C mod[7];
printf("\n\t\t\tProgram to Calculate time to travel based on distance and vehicle\n\n");
printf("\tEnter the Distance in KM\n\t");
scanf("%d",&distance); //takes distance as input
printf("\tEnter the mode of transportation as below\n");
printf("\t1.Bike\n\t2.Bus\n\t3.Flight\n\t4.Train\n\t5.Ship\n\t");
scanf("%d",&mode); //entering which mode
switch(mode) //to calculate time of each mode
{
case 1: tim=time(60);
break;
case 2: tim=time(80);
break;
case 3: tim=time(814);
break;
case 4: tim=time(180);
break;
case 5: tim=time(40);
break;
default:printf("Mode of Transport not available\n");
exit(0);
}
switch(mode) //to save the mode of transportation in a variable
{
case 1: strcpy(mod,"Bike");
break;
case 2: strcpy(mod,"Bus");
break;
case 3: strcpy(mod,"Flight");
break;
case 4: strcpy(mod,"Train");
break;
case 5: strcpy(mod,"Ship");
break;
}
printf("\n\tThe time taken by %s is %f hours",mod,tim); //displaying result
}

Output:

The time taken by Flight is 0.429975 hours

Student Signature with Date:

You might also like