Please Help a method do not calculate

hi i have a class called property type of the class is abstract and i m over riding a method from it which is suppose to calculate the amount(charge).
i m using an other calss (PrivateProperty ) to extend the property class
every thing works fine but the method charges do not work at all
when i call the method getTotal_Charges
i get 0.0
as return from getTotal_Charges method
here is the code for Property Class
//Base Class.java
public abstract class Property
protected String address = "unknown";
protected String payer = "unknown";
protected float charge = 0.00F;
public Property(String location, String name)
address = location;
payer = name;
public String toString()
String temp = new String("");
temp += "Payer: " + payer + '\n';
temp += "Property: " + address + '\n';
return temp;
public abstract void charges();
Here is the code for PrivateProperty
public class R_Property extends Property {
//\/\/\/To share a variable beween all the instances of a class\/\/\
//\/\/\/we can do this by declaring the variable as static.\/\/\/\/\
//\/\/\/Ref: Handouts "Static Variables"\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
//\/\/\/\/\/\/\/******* Variable Declaration******* \/\/\/\/\/\/\/\
//Variable to hold Units Used value
private static int units_Used = 0;
//Variable to hold Standing charge value
private static float standing_Charge = 37.5F;
//Variable to hold Unit Ratevalue
private static float unit_Rate = 0.0567F;
//\/\/\/\/\/\/\/Constructor/\/\/\/\//\/\//\/\/\
//\/\/\//\/\/\Ref: Handouts Inheritance/\/\/\/\
public R_Property(String location, String name)
super(name, location);
//\/\/\/\/\/\/Charges Method from Base Class\/\/\/\/\/\
public void charges() {
charge = (standing_Charge + (units_Used * unit_Rate));
//\/\/\/\/\/\Setter Method For Units Used/\/\/\/\
public void setUnitsUsed(int units)
units_Used = units;
//\/\/\/\/\/\/\/\Setting Getter Methods For/\/\/\/\/\/\
//\/\/\/\/\/\/\/\Standing Charges UnitRate /\/\/\/\/\/\
//\/\/\/\/\/\/\/\ and Total Charges \/\/\/\/\/\/\/\/\/\
public String getStandingCharge() {
return String.valueOf(standing_Charge );
public String getUnitRate() {
return String.valueOf(unit_Rate );
public String getUnitsUsed() {
return String.valueOf(units_Used);
public String getTotal_Charges() {
return String.valueOf(charge);
}

arg your comment style is very annoying
anyways since i dont see your main method this is just a guess but
charge = (standing_Charge + (units_Used * unit_Rate));
here units used is a integer ie a int and is being multiplyed by a float this might not throw a error
and you might need to wrap it
in your method then agian that might not be the cause you should post the run or main method you are useing to call your methods
charge = (standing_Charge+( (float)( units_Used ) * (float)( unit_Rate ) ));

Similar Messages

  • Please help as I do not know what to do or even what step to take next

    I really need to solve this problem as I cannot receive mail in my Mail program except that each day one message—the same message—arrives. It comes from Mail Delivery System and the subject is Delivery Status Notification (Failure). No matter what time it arrives, it still has the date of 9/15 and the time of 8:39 AM. All other mail stays at Gmail and is not imported. This began I think when I opened one of those Mail Delivery System messages and it was completely blank, just one blank box.
    In answering, please realize that I am not extremely computer-savvy.
    I left a message here about my problem before (this weekend) but now cannot seem to find it. Do messages drop off?
    Thanks for any help.

    Welcome To  Discussions Story!
    Here is your other Topic regarding this issue Please help as I do not know what to do or even what step to take next.
    There are responses to your query in that Thread.
    To view previous posts you have made, click on your Alias Story, next to Welcome, or click on My Posts, or My Questions.
    If you are logged in to  Discussions, those links will appear on the upper right side, of all Discussions pages.
    ali b

  • I have apple id but in this week i see this error : you must verify your payment info befor you can make purchases. please help me. i have not credit card but i buying apps with gift card. please help me

    i have apple id but in this week i see this error : you must verify your payment info befor you can make purchases. please help me. i have not credit card but i buying apps with gift card. please help me

    Why do you keep making multiple posts with this issue? You have now posted it three times in the last hour and have two different people helping you in two different threads!
    https://discussions.apple.com/message/18606895
    https://discussions.apple.com/message/18606685
    This is bad internet manners.

  • I am unable to download Acrobat XI Standard purchased 19Feb15 & unable to locate on your web site simple steps to do this - please help; what am I not doing?

    I am unable to download Acrobat XI Standard purchased 19Feb15 & unable to locate on your web site simple steps to do this - please help; what am I not doing?

    Make sure you have cookies enabled and clear your cache.  If it continues to fail try using a different browser.

  • Please help! I do not see the songs on my iphone when it's connected to my computer .  I want to transfer the songs back / forth.  thanks in advance.

    Please help! I do not see the songs on my iphone when it's connected to my computer in Itunes.  I want to transfer the songs back / forth.  thanks in advance.

    iOS 7.1 update requires approximately 350MB's of storage space.
    Tap Settings > General > About > Available to see free storage space.
    Very important to never allow the free storage space to fall below at the very least 500MB's or your iPhone may not boot.
    You need to free up storage space on your iPhone for future updates as well.
    Help here >  6 Tips to Free Up Tons of Storage Space on iPad, iPhone, and iPod Touch

  • Please help my iMac will not start. The apple logo comes up and the wheel goes round and then I am left with an empty white sceen can anyone help

    Please help, my iMac will not start up, the apple comes up and the wheel goes round but then I am left with a blank white screen. Has anyone any ideas.

    Locate your original install disk (it's grey) and use it to restart your iMac by holding the "C" key during startup. Use the disk utility to repair your harddrive.

  • TS2446 Please help me,I can not purchase from apple store becuse it is ask me the secirty question in my apple ID but I forget my secrity question

    Hello,
    Please help me,I can not purchase from apple store becuse it is ask me about the secirty question in my apple ID but I forget my secrity question.
    Thanks,

    If you can't remember them then go to Express Lane  and select 'iTunes' from the list of 'products' in the middle of the screen.
    Then select 'iTunes Store', and on the next screen select 'Account Management'
    Next choose 'iTunes Store Account Security' and fill in that you'd like your security questions/answers reset.
    You should get an email reply within about 24 to 48 hours (and check your Spam folder as well as your Inbox). A month or two ago Apple had temporarily suspended the reseting of security question/answers whilst account security processes were improved, but that may now have finished.

  • Please help, i movie is not exporting or sharing movies, it will closed unexpectedly please help?

    Please help, i movie is not exporting or sharing movies, it will closed unexpectedly please help?

    Hi Videoframe
    This was emailed to Apple Support on 23 DEc 2012 at 09:50 Eastern Australia time.
    "I continued to talk to other Apple Mac users on iMovie….Interesting to have found out that their movies were made using iDVD without any known issues as yet…Looking at the results from Apple Support Forum and Youtube, problems appears to be when NOT using iDVD. I and many others can't understand how these many technical problems were overlooked by the programmers of iMovie. One would have thought iMovie problems have been iron out prior to getting rid of iDVD. By the way when I first contacted Apple Support back on 16th Nov, I was told I need to RE-INSTALL my computer…..that I did and in the process my iDVD was removed and never was re-installed.
    May I suggest you delegate a junior person or someone string together a project consisting over near 1700 images, approx. 25mins of video footage, titles and including with and without transitions then export the project.
    I am still in the dark as to what is being done about this extended non result. I am not sure if is known by the people who is in charge of this iMovie programme. it would be nice to get some sort of feedback. Not sure if I should refer this to a third party to do the testing?? I am sure Apple's competitors would love to make a mockery of this.
    There has to be a time frame for this to end, as I and many others can't simply sit here in the dark and wait for someone to come back for a solution, this could be months or years who knows.  As you can appreciate I am not the only user anxiously waiting for a solution.
    I guess I am in a way representing other worldwide users in pursuing a solution on this matter ASAP. I therefore ask you to please make this a priority if this is at all possible.
    Many thanks."
    I've been corresponding to them since Fri 16th Nov on and off without a solution.

  • Please Help, my Iphone will not download my music.

    Okay, so I just restored my Iphone and switched over to a new computer. All my music is on this computer and my Iphone 3GS will sync with the itunes, but when I press sync it simply syncs, and then says the sync is complete without downloading any of the music I have put up. I have no idea what is wrong, someone please help. I have not checked off my music to not be downloaded either.

    Have you clicked on the Sync music button at the top of the Music tab in iTunes ?

  • Please help, my iPod could not backing up on iTunes.

    Please help, my iPod could not backing up on iTunes. It always says, "iTunes could not back up the iPod because the backup was corrupt  or not compatible with the iPod.  Delete the backup for this iPod, then try again." What's wrong with my iTunes??

    look at the brightside at least your computer sees yours

  • Please help, my music would not open after syncing to computer.

    Please help, my music would not open after syncing to computer.

    Try quitting the music app completely and restart your iPad.
    Go to the home screen first by tapping the home button. Double tap the home button and the task bar will appear with all of your recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button or anywhere above the task bar. Restart the iPad.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    If that didn't help - reboot your iPad. Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    If that doesn't work, there may be a corrupt song in your Music app that you have to find and remove.

  • I can buy my needs from the game says I tell customers to help please help me Visa card not working in any Itemes games

    I can buy my needs from the game says I tell customers to help please help me Visa card not working in any Itemes
    games

    If you mean that you have been instructed to contact iTunes support, then will need to do what it says, contact iTunes Support. These are user-to-user support forums, if you thought you were contacting Apple by posting here. Go here:
    http://www.apple.com/emea/support/itunes/contact.html
    to contact the iTunes Store.
    If that does not answer your question, try posting in your native language, or find a friend with a better command of English to help you ask your question here.
    Regards.

  • Please help! Ipod touch not turning on :(

    okay, i have a Ipod touch 5th gen, had it a couple months now. this morning i put my ipod in its normal place- a draw, and no one could have been on it. when i get home however it's dead. i thought it needed to charge so i plugged it in, i left it for a few minuets but it still didnt turn on! I now have it plugged to my laptop and its not being recognised at all. i've pressed the home button to try and turn it on but nothing is happening! i havent done anything for it to brake please help!

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try on another computer
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • Please help -- .options method not working in MAC IE 5.0

    Hi,
    My requirement is to dynamically populate a drop down box (combo box) in a JSP Page, using a javascript function, with some values. This happens on click of some button.
    I am using the below function to populate the drop down box. This runs fine in Windows IE, but in MAC, i get a javascript error saying " 'options' is not an object". Can anybody please tell me how to go about this? Is there any other way in which i could populate a drop down box? I need this to work in both Windows and MAC. Please help!
    Function used:
    // add an option item to the list
    function fnAddListItem(obj)
    optname = new Option("Sample","1",false,false);
    obj.options[obj.length] = optname;
    P.s: 'obj' here is my drop down box.
    eval("document.forms[0].drpSampleBox");
    Thanks in advance,
    -Santhi.

    Try using document.createElement("Option"); as shown below. It might help u
    var tblSpace = document.getElementById("drpSampleBox");
    var optionObjt = document.createElement("Option");
    optionObjt.text = "<DEFAULT>";
    optionObjt.value = "<DEFAULT>";
    tblSpace.add(optionObjt);
    for(i=0;i<array.length;i++)
         optionObjt = document.createElement("Option");
         optionObjt.text = array;
         optionObjt.value = array[i];
         tblSpace.add(optionObjt);

  • Please help regarding method/function sign up validation with mysql jdbc.

    HI guys,
    I am have been fixing this problem for days, hope that someone could help me find the bug on my code.
    I have 3 files:
    1.WithAuth.java - for database jdbc mysql connection
    2.WithAuthMet.java - method that will read any variables that will be passed to it. this method is waiting for two variables, a and b. a for userName and b for userPassword.
    3.WithAuthTest.java - the testing class, this is where i declare my sample control data to test the database connection and query.
    here's the actual codes:
    WithAuth.java
    package com.Auth;
    public class WithAuth {
        static String userName = "root";
        static String userPassword = "";
        static String databaseUrl = "jdbc:mysql://localhost:3306/javatowebservice";
        static String userQuery = "select * from userlogin";
    }WithAuthMet.java
    - this is where the error is and where I messed up.
    package com.Auth;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class WithAuthMet extends WithAuth {
        public void connect(String a, String b)throws Exception{       
            //try {
                Class.forName ("com.mysql.jdbc.Driver").newInstance ();               
                Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
                Statement stat = conn.createStatement();   
                String query = userQuery;
                ResultSet result = stat.executeQuery(query);
                System.out.println("Result(s): ");
                  while (result.next ()){
                      int i = result.getInt("userId");
                      String name=result.getString("userName");
                      String password=result.getString("userPassword");
                          //System.out.println("test data:"+a);
                      if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){
                                System.out.println("User is Valid");
                            else{
                                System.out.println("You are not a Valid User");
                                System.out.println("test data:"+name);
                                System.out.println("test data:"+password);
                                System.out.println("test data:"+a);
                                System.out.println("test data:"+b);
                      //conn.close();
                   // }catch(Exception e){
                    //System.out.println("Exception is ;"+e);
                    //System.out.println("Exception is ;");
    //                if(a.equals(name.("userName"))
    //                    && password.equals(password.equals("userPassword"))){
    //                    System.out.println("User is Valid");
    //                else{
    //                    System.out.println("You are not a Valid User");
    } WithAuthTest.java
    package com.Auth;
    public class WithAuthTest extends WithAuthMet{
        public static void main(String[] args) throws Exception{
            WithAuthMet CTD = new WithAuthMet();   
            String a = "dan";
            String b = "password";
            //CTD.connect(String name,String password);
            CTD.connect(a, b);
            //return connect;
    }please help.

    yakultyakultyakult wrote:
    WithAuthMet.java
    - this is where the error is and where I messed up.
    package com.Auth;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class WithAuthMet extends WithAuth {
    public void connect(String a, String b)throws Exception{       
    //try {
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();               
    Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
    Statement stat = conn.createStatement();   
    String query = userQuery;
    ResultSet result = stat.executeQuery(query);
    System.out.println("Result(s): ");
    while (result.next ()){
    int i = result.getInt("userId");
    String name=result.getString("userName");
    String password=result.getString("userPassword");
    //System.out.println("test data:"+a);
    if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){
    System.out.println("User is Valid");
    else{
    System.out.println("You are not a Valid User");
    System.out.println("test data:"+name);
    System.out.println("test data:"+password);
    System.out.println("test data:"+a);
    System.out.println("test data:"+b);
    //conn.close();
    // }catch(Exception e){
    //System.out.println("Exception is ;"+e);
    //System.out.println("Exception is ;");
    //                if(a.equals(name.("userName"))
    //                    && password.equals(password.equals("userPassword"))){
    //                    System.out.println("User is Valid");
    //                else{
    //                    System.out.println("You are not a Valid User");
    This is one line that is wrong
                       if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){You have 'a' and 'b which are Strings
    and you are comparing them [using equals()] with the boolean return from another set of equals() invocations.
    String equals boolean will always be false (well, maybe not if the String is "TRUE" or "FALSE" - and you would need some more boilerplate to make that work).

Maybe you are looking for

  • Unable to open portal project in workshop

    Hi, I am totally new to WLS92 and Eclipse. Here is my question. I created a portal project in Workshop using the wlp_getting_started.pdf guide. Later on I closed the portal project using Project->Close Project menu. Now when I start Workshop, it does

  • Error while impoting XML schema format

    Hi Experts, I have successfully generated XSD schema from XML file by using third party tool but I was getting the below mentioned error while importing XML schema.Kindly suggest your ideas. Error:Cannot Import metadata. XML Parser failed:<invalid el

  • A statement really.  iPhoto is the worst piece of software I've ever tried to use.  I plan to stop using it.

    Faces causing problems.   Distorted the photos when I moved them from my previous Mac OSX.   I don't want "faces" but don't how to disable that. It has created 30,000 records!  It has pulled faces of complete strangers out of some photos!

  • What to put in x3 ultrabase in the ultrabay 2000?

    I have discovered there is a blu-ray device 43n3200 but it requires an Ultrabay Enhanced to Ultrabay 2000 adapter 73P3268. Further, some say the 16mb GPU (VPU) of the x31-2672XXL will not support blu-ray well. Any thoughts? My x31 is a P-IV-M1.4 w/2g

  • Crystal Reports XI - Error when displaying report

    Hi Guys, I'm using Crystal reports XI release 2. I'm attempting to get some data from an Oracle database and display it as a Crsytal Report onto a JSP. Tomcat 5.0 is being used. At first I was using Crystal XI and than upgraded to Release 2. Here's t