Solved

Simple one for delphi newbie

Posted on 2002-04-21
1
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

623 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