Page 1 of 1

Question 1: A student has to travel n kilometres. He can choose between three types of transportation: Starting fee Day

Posted: Fri Jul 01, 2022 5:33 am
by answerhappygod
Question 1 A Student Has To Travel N Kilometres He Can Choose Between Three Types Of Transportation Starting Fee Day 1
Question 1 A Student Has To Travel N Kilometres He Can Choose Between Three Types Of Transportation Starting Fee Day 1 (55.76 KiB) Viewed 58 times
Question 1: A student has to travel n kilometres. He can choose between three types of transportation: Starting fee Day rate Taxi 3 SAR Bus Train Night rate 4 SAR/km 5 SAR/km 0.5 SAR/km 0.5 SAR/km minimum 20 km 0.25 SAR/km 0.25 SAR/km minimum 100 km Taxi. (Starting fee: 3 SAR). Day rate: 4 SAR/km. Night rate: 5 SAR/km. Bus. Day/Night rate: 0.5 SAR/km. Can be used for distances of minimum 20 km. distances Train. Day/Night rate: 0.25 EUR/km. Can be used for distances of minimum 100 km. Write a program that reads (the number of kilometres n) and {period of the day (day or night)} and calculates the price for the cheapest transport. Hint: you will read the input data and depending on the distance, you will choose the cheapest transport. To do that, you will write a few conditional statements Run 1: Please Enter the distance (the number of kilometers): 18 Please Specify the Day rate (day OR night) The price of the cheapest transport is 43 SAR Run 2: Please Enter the distance (the number of kilometers): 10 day Please Specify the Day rate (day night) The price of the cheapest transport is 53 SAR Run 3: Please Enter the distance (the number of kilometers): 25 Please Specify the Day rate (day OR night) day The price of the cheapest transport is 12.5 SAR Run 5: Please Enter the distance (the number of kilometers): 110 Please Specify the Day rate (day Of night) :day The price of the cheapest transport is 27.5 SAR Run 4: Please Enter the distance (the number of kilometers): 25 Please Specify the Day rate (day or night) night The price of the cheapest transport is 12.5 SAR Run 6: Please Enter the distance (the number of kilometers): 118 Please Specify the Day rate (day night) night The price of the cheapest transport is 27.5 SAR