You are not logged in.
hi I got a problem into a question but I even didn't understand its solution ! I have the exercise with its solution
You want to find out which fraction of your car’s use is for commuting to work, and which is for personal use. You know the one-way distance from your home to work. For a particular period, you recorded the beginning and ending mileage on the odometer and the number of work days. Write an algorithm to settle this question
solution :-
// Input is one way distance, beginning mileage, ending mileage, number of work days // question asks only for fraction “commuting to work” thus we don’t need to count // the fraction commuting back home
total miles traveled = ending mileage – beginning mileage miles traveled to work = one way distance * number of work days
// This is what we wanted to know: fraction of miles for commute = miles traveled to work / total miles traveled
// Personal use is whatever is left over fraction of miles for personal use = 1 – fraction of miles for commute
what is the meaning of ( fraction of your car’s use ) sorry but I'm not good in English
and can anyone give me explanation of this problem in anyway so can beginner like me understand it pls
Wisdom is a tree which grows in the heart and fruits on the tongue
Offline
Firstly I think it is intended that both the journey to work and the journey back home should be counted as part of "commuting to work". Other wise you are counting the journey home as "personal use" and it isn't.
Let's make up some figures.
Miles to and from work in one week = 168 miles.
Total miles on the odometer = 300 miles.
Then the fraction for travel to work is 168/300 = 56/100
Bob
Children are not defined by school ...........The Fonz
You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you! …………….Bob
Offline