Solved

Simple one for delphi newbie

Posted on 2002-04-21
1
177 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
Comment Utility
This should work:

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now