Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE c Language to solve this problem... Hints: #include #define NOP -1.0 .. .. //Complete your code Write a program to print the rail fare

image text in transcribed

USE c Language to solve this problem...

Hints:

#include #define NOP -1.0

..

..

//Complete your code

Write a program to print the rail fare between two rail stations. The graph that connects these stations is shown in Figure 1. Use adjacency matrix to represent the graph. RM 5.40 1 0 RM 2.20 0 - Kota Damansara 1-Sentul 2-Pasar Seni 3- KL Sentral 4-Bandar Puteri 5-Kajang RM 4.50 RM 1.30 3 2 RM 4.60 RM 4.10 5 Figure 1 The program should a) Print the list of towns using a function called printStations [2 marks] b) Prompt user to key in an origin and destination station. [1 mark] Print the rail fare between the stations. If there are no direct route, print "No direct route" [7 marks) An example of the output is shown in Figure 2. Stations 0 Kota Damansara 1 Sentul 2 Pasar Sena 3 KL Sentral 4 Bandar Puteri 5 Kajang Origin: 0 Destination: 3 Kota Damansara to KL Sentral: RM 4.50 Figure 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions

Question

Knowledge of project management (PMI) teachings

Answered: 1 week ago