필터 지우기
필터 지우기

Need help to write code for this:

조회 수: 4 (최근 30일)
Nava  Subedi
Nava Subedi 2016년 11월 25일
답변: shubhodeep 2023년 11월 28일
I need to write code to calculate the total bus fare.
Fare for first 5 mile is $5, then up to 20 miles is 50 cent per mile and then above 20 miles is 20 cents.
There is a discount of 10% for junior citizen up to 18 years and senior above 60 years.

답변 (2개)

Walter Roberson
Walter Roberson 2016년 11월 25일
Test to see if the passenger is a junior or senior. If so then say that the fare is 18 cents. Otherwise say that the fare is 20 cents.
No matter how close the passenger destination is from their origin, the passenger can achieve this fare by riding back and forth on the bus until they have reached 20 miles, and then proceeding as directly as feasible to their destination, since the fare for 20 or more miles is only 20 cents, which is less than it would cost to go one bus stop ($5)

shubhodeep
shubhodeep 2023년 11월 28일
find the passenger name , ticket no. class, with the maximum fare using matlab script and also check weather this passenger survived or not

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by