Can someone tell me the basic logic of this program? I don't want the code, just this that what exactly is it I am supposed to do here? I can't seem to understand the question.
(This is basically a pic. I don't know how to post a pic here so I'm trying to paste it in words in best format possible)
Assign a value to double variable cost depending on the value of integer variable distance as follows:
Distance Cost
------------ --------
0 through 100 5.00
More than 100 but not more than 500 8.00
More than 500 but less than 1,000 10.00
1,000 or more 12.00
Now, what I get from it is I am supposed to assign one integer for distance and input it from the user and then I have to output the cost of that distance (like if he inputs 56, program should output Cost = 5.00)
But then what is the point of assigning a double variable? Since the cost is also an integer value and not a decimal value.. Or is it only because I must also show two "Zeroes" with 5? (which I can easily do by using setpricision(2) function)
My concern is this that I don't think the program would be so easy... And hence, I am confused whether I am understanding it the right way or not.
Would be really glad for any help. Thank you!
(Sorry for my English, it's not my first language)