Write an algorithm to input number of passengers travelling, Data Structure & Algorithms

Assignment Help:

There are ten stations on a railway line:

817_line.png

Train travels in both directions (i.e. from 1 to 10 and then from 10 to 1).  Fare between each station is $2.

A passenger inputs the number of station at the start of his journey and number of the destination station and fare is calculated (for example if a passenger gets on a station 3 and his destination is station 9 his fare would be $12). Calculation should take into account the direction of train (for example a passenger getting on at station 7 and getting off at station 1 will also pay $12 and not a negative value!!).

A discount of 10% is given if 3 or more passengers are travelling together.

Write an algorithm by using a flowchart that:

  • input number of passengers travelling
  • input station number of the starting point and the station number of the destination
  • calculates the total fare taking into account the direction of travel
  • calculates any discount due
  • outputs the cost of tickets and prints tickets

 

 


Related Discussions:- Write an algorithm to input number of passengers travelling

Algorithm, Algorithm to find sum of square of a number

Algorithm to find sum of square of a number

Queues, what is queues? how it work? and why it used? i want an assignment...

what is queues? how it work? and why it used? i want an assignment on queue .....

Explain the stack, QUESTION Explain the following data structures: ...

QUESTION Explain the following data structures: (a) List (b) Stack (c) Queues Note : your explanation should consist of the definition, operations and examples.

Tree, application of threaded binary treee

application of threaded binary treee

Delete a given node from a doubly linked list, Algorithm to Delete a given ...

Algorithm to Delete a given node from a doubly linked list Delete a Node from Double Linked List DELETEDBL(INFO, FORW, BACK, START, AVAIL,LOC) 1. [Delete Node] Set FOR

What are circular queues, What are circular queues?  Circular queue: St...

What are circular queues?  Circular queue: Static queues have a very large drawback that once the queue is FULL, even though we erase few elements from the "front" and relieve

Method for keeping two stacks within a single linear array, Q. Define a met...

Q. Define a method for keeping two stacks within a single linear array S in such a way that neither stack overflows until entire array is used and a whole stack is never shifted to

Bubble sort, Q. The reason bubble sort algorithm is inefficient is that it ...

Q. The reason bubble sort algorithm is inefficient is that it continues execution even after an array is sorted by performing unnecessary comparisons. Therefore, the number of comp

The game tree, An interesting application or implementation of trees is the...

An interesting application or implementation of trees is the playing of games such as tie-tac-toe, chess, nim, kalam, chess, go etc. We can depict the sequence of possible moves

Branch and Bound method, give some examples of least cost branch and bound ...

give some examples of least cost branch and bound method..

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd