Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Sorry, 1 qns to ask

Thread view: 
JeffJak - 14 May 2007 14:37 GMT
Gas Used                         Rate
First 100 cubic meters    $5.00 minimum cost
Next 200 cubic meters    4 cents per cubic meters
Next 200 cubic meters    2 cents per cubic meters
Above 500 cubic meters    1 cent per cubic meters

I need to create a java to calculate this ^
i only know for the first 100 cm
(gas <= 100)
        {cost = 5.00;
        }

but i dont know how to do the next steps..
can u just show me the next step to calculate the "next 200cm" and i
will try to continue on myself.
Thanks in advance.!!
Gordon Beaton - 14 May 2007 14:43 GMT
> but i dont know how to do the next steps.. can u just show me the
> next step to calculate the "next 200cm" and i will try to continue
> on myself.

Here's a hint: start at the other end! Check first for >500, calculate
the price for the part that exceeds 500, then subtract those and move
*down* to the next level.

/gordon

--
JeffJak - 14 May 2007 14:51 GMT
> > but i dont know how to do the next steps.. can u just show me the
> > next step to calculate the "next 200cm" and i will try to continue
[quoted text clipped - 7 lines]
>
> --

so i need to declare a few variations?? eg, ans 1 = ans2 - 100
cost = ans2 *0.05
Thomas Fritsch - 14 May 2007 15:31 GMT
> Gas Used                            Rate
>  First 100 cubic meters        $5.00 minimum cost
[quoted text clipped - 7 lines]
>          {cost = 5.00;
>          }
if (gas >= 100 and gas <= 200)
          {cost = 5.00 + (gas - 100) * 0.04;
          }

and so on...
(the formulas for the next gas ranges will get more and more complicated)

> but i dont know how to do the next steps..
> can u just show me the next step to calculate the "next 200cm" and i
> will try to continue on myself.
> Thanks in advance.!!

Signature

Thomas



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.