Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simple one for delphi newbie

Posted on 2002-04-21
1
Medium Priority
?
185 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 120 total points
ID: 6957922
This should work:

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

670 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