How to get the correct value by calculating double values....

Ads
 

How to get the correct value by calculating double values....

Hello Sir, I have a method in which i am getting getting wrong datavalues calculated from the function ...here is my code for this task....

 try {
         //DecimalFormat df = new DecimalFormat("#.##");
        double min = 60;
        double cost = 0;
        double quotient = duration / min;
        double rem = duration % min;
        if (rem >= 0) {
            double quotient1 = quotient + 1;
            cost = quotient1 * rateperpulse;
           // df.format(cost);
            System.out.println(cost);
        }

duration is integer type and values like 59,142 etc

here i am getting wrong output for the same duration 59 i am getting wrong cost .. Sir plz help me in this code.Thank you Sir.

View Answers

Ads









Related Tutorials/Questions & Answers:
How to get the correct value by calculating double values....
How to get the correct value by calculating double values....  Hello... { double min = 60; double cost = 0; double quotient = duration / min; double rem = duration % min; if (rem >= 0
How to get the correct value by calculating double values....
How to get the correct value by calculating double values....  Hello... { //DecimalFormat df = new DecimalFormat("#.##"); double min = 60; double cost = 0; double quotient = duration / min
Advertisements
Get the smallest double greater than the given value
Get the smallest double greater than the given value This section demonstrates you how to get the smallest double value greater than the given value. Java... a value of double type. Now to determine it, we have invoked the nextDouble() method
how to get radio value
how to get radio value    how to retrive the option value and insert the next table pls give example
how to get the checkbox value in jsp
how to get the checkbox value in jsp  how to get the checkbox value in jsp?   JSP CheckBox Example - how to get the checkbox value in jsp
How to get a values - JSP-Servlet
getting a null value aprt from a attachmented file,so how to get a other values...How to get a values  Dear sir, I have a one form with a multipart/form-data as follows To From Subject
How to get enum value in Java
How to get enum value in Java  Hi all, i am looking for a solution to get an enum value from index in Java. Please suggest. Thanks
how to get HTTP GET request value using javascript
how to get HTTP GET request value using javascript  how to get HTTP GET request value using javascript   how is how you can get HTTP GET...( "?", "" ); // will return the GET parameter var values = parameter.split
How to save and get value from JSP
324 2012-12-12 save i want to save dis value jsp to action ...how can i get all value ..and store..how can its values goes...How to save and get value from JSP  Employee Name Time
how to get the values to dropdownlist from oracle database
how to get the values to dropdownlist from oracle database   <...='countryname' onchange="showState(this.value)"> <option value... * from countryname"); while(rs.next()){ %> <option value="<
how to get time picker value in javascript of struts2
how to get time picker value in javascript of struts2  I am not able to get value of time picker in java script . my code is jsp java script var totime=dojo.widget.byId("totime").getValue(); how to get value please help me
How can I get query string values in JavaScript?
How can I get query string values in JavaScript?  How can I get query string values in JavaScript?   To get a query string value, you can use JQuery and JavaScript.. here is the code: function getParameterByName(name
according to me its ok but is calculating wrong values in
according to me its ok but is calculating wrong values in   program...=newNumeralz6.length(); if(newNumeral6.equals(s)) { System.out.println("enter the correct roman value 1 in place of IC"); newNumeral6="0"; } do
How to get the values from the Combo Box - JSP-Servlet
How to get the values from the Combo Box   Sir, Actually i am getting the values in the combo box from table.I want what ever the value i select in combo box its corresponding records will display
How to store two integer value in a separate file and retrieve those values
How to store two integer value in a separate file and retrieve those values  I need to save two values so i can use those values later i came up with idea of saving those values in a separate file and updating values in file
How to get more than one value from ajax
How to get more than one value from ajax  I have multiple select list box in php. i filled the value using ajax. how to get different value to fill the same list box Ex. option value as id option name as some string
how to get the values from dynamically generated textbox in java?
how to get the values from dynamically generated textbox in java?  I... to get and update this textbox values into both the tables(Xray,CTScan... textbox corresponding to the data. I want to get data from textboxes(generated
how to get the value of a label field of option tag in javascript?
how to get the value of a label field of option tag in javascript?  example <select> <option label="2" value="A">A<...;/select> can i get the label value in javascript
If Sessin Contain Array how can i get each value.
If Sessin Contain Array how can i get each value.  sir, i m trying to get value form session and session contain array i mean .. whatever... to use this value in different conditions..so how can i get it.. Thank u
how to get a column values from a excel file after attaching it - JSP-Servlet
how to get a column values from a excel file after attaching it  hi sir, How to get a column values from a excel file after attaching it while... and get a values from that store that value in To input box.Please help me sir
how to get values for same column name from two different tables in SQL
how to get values for same column name from two different tables in SQL  how to get values for same column name from two different tables in SQL???? column name is emp_id loacated in these two tables company,employee
how to convert string to double in java
how to convert string to double in java  Hi, I have String variable with double value in it. how to convert string to double in java? Thanks   Hi, Use the function: Double.parseDouble(s) of Double class
how to convert string to double in java
how to convert string to double in java  Hi, I have String variable with double value in it. how to convert string to double in java? Thanks   Hi, Use the function: Double.parseDouble(s) of Double class
how to convert string to double in java
how to convert string to double in java  Hi, I have String variable with double value in it. how to convert string to double in java? Thanks   Hi, Use the function: Double.parseDouble(s) of Double class
how to convert string to double in java
how to convert string to double in java  Hi, I have String variable with double value in it. how to convert string to double in java? Thanks   Hi, Use the function: Double.parseDouble(s) of Double class
how to read the values for text and csv files and store those values into database in multiple rows..means one value for one row
how to read the values for text and csv files and store those values into database in multiple rows..means one value for one row  Hai, I need... or .txt) file and get the values from that file and store them into database
Conversion from int to double
Conversion from int to double: In this tutorial we will learn how to convert an int type value to double type data. Description: This program will take two int value from console and provide the division of these int values
How to get Keys and Values from HashMap in Java?
How to get Keys and Values from HashMap in Java? Example program of iterating... to iterate the keys and get the values and print on the console. How to get keys... to iterate through keys and get the values. So, let's see how to iterate
get textfield value in javascript
get textfield value in javascript  How to get and the set value of text field in JavaScript?   Get the text field value in JavaScript <..."> <input type="button" value="Convert" onclick="convertText()">
Conversion from double to float
Conversion from double to float: In this tutorial we will learn how to convert a double type value to float type value. Description: This program will take a double value from console and provide the conversion to float type
Conversion from double to int
Conversion from double to int: In this tutorial we will learn how to convert a double type value to int type value. Description: This program will take a double value from console and provide the conversion to int type. The line

Ads