Solved

Simple one for delphi newbie

Posted on 2002-04-21
1
180 Views
Last Modified: 2010-04-04
Hi

I need help with a function that calculates costs of using the internet at a internet cafe. The cost is $25 per hour calculated half-hourly. So each half hour is 1 Unit. If the time is 30mins that should be 1 Unit and 31Mins 2 Units etc etc

I am having problems working out how many units have been used. At the moment if you have been using it for 30mins you are charged 2 Units(where it should be 1):

function GetUnits(pintTotalMins: Integer) : Integer;
begin
        GetUnits := (pintTotalMins DIV 30) + 1
end;

Cheers,

S
0
Comment
Question by:G-Love
1 Comment
 
LVL 1

Accepted Solution

by:
JDN earned 30 total points
ID: 6957922
This should work:

GetUnits := ((pintTotalMins - 1) DIV 30) + 1
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question