Getting output of 2 numbers after the decimal point

user3250337

New to java, i am trying to get output of variables grossPayConv, taxesConv and netPayConv to have the output of XX.XX(having 2 places after the decimal). i believe i am casting wrong or something. i keep getting numbers with no values after the decimal. thanks, sorry for the basic question, can't seem to get it.

P.S = if your curious about the variable names... Conv - meaning conversion

System.out.println("hours worked: ");
double hours = input2.nextDouble();

System.out.println("hourly pay rate: ");

double payHours = input3.nextDouble(); 
double grossPay = payHours*hours;
double grossPayConv = (int)(grossPay*100)/100;
double taxes = grossPay*TX;
double taxesConv = (int)(taxes * 100) / 100;
double netPay = grossPay-taxes;
double netPayConv = (int)(netPay*100)/100;
Kick

Why are you casting the output to int.Update as below :

double grossPayConv = (grossPay*100)/100;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Ruby big decimal with 2 numbers after the decimal point

From Dev

Checking if input is a float and has exactly 2 numbers after the decimal point

From Dev

In a unix timestamp should there be numbers after a decimal point?

From Dev

storing the numbers after the decimal point into a variable in MySQL

From Dev

Not getting the number after decimal point in android

From Dev

How to remove numbers after decimal point in PIE reports in ssrs 2008 R2

From Dev

Extracting numbers with a decimal point from ls output in Bash

From Dev

Ruby output numbers to 2 decimal places

From Dev

Need only 2 digits after decimal point

From Dev

Excel to csv file conversion - conserve numbers after the decimal point

From Dev

How Edittext can accept only two numbers after decimal point

From Dev

JQuery allow only two numbers after decimal point

From Dev

Find the position of the digit after decimal point that is different between two numbers

From Dev

Excel to csv file conversion - conserve numbers after the decimal point

From Dev

Ensuring number has 2 numbers after decimal

From Dev

Length after decimal point

From Dev

UITextField accepting only one decimal point with max 3 digits before decimal point & max 2 digits after decimal point

From Dev

Make decimal point to whole numbers

From Dev

Make decimal point to whole numbers

From Dev

Convert floating point numbers to decimal numbers

From Dev

Getting numbers behind decimal separator

From Dev

Roman numbers to decimal numbers, getting garbage value

From Dev

Roman numbers to decimal numbers, getting garbage value

From Dev

Selecting floating point numbers in decimal form

From Dev

Conversion of decimal floating point numbers to binary and back

From Dev

how to subtract numbers with decimal point in php

From Dev

Aligning numbers at decimal point angular ui grid

From Dev

Formatting Numbers So They Align On Decimal Point

From Dev

Conversion of decimal floating point numbers to binary and back

Related Related

  1. 1

    Ruby big decimal with 2 numbers after the decimal point

  2. 2

    Checking if input is a float and has exactly 2 numbers after the decimal point

  3. 3

    In a unix timestamp should there be numbers after a decimal point?

  4. 4

    storing the numbers after the decimal point into a variable in MySQL

  5. 5

    Not getting the number after decimal point in android

  6. 6

    How to remove numbers after decimal point in PIE reports in ssrs 2008 R2

  7. 7

    Extracting numbers with a decimal point from ls output in Bash

  8. 8

    Ruby output numbers to 2 decimal places

  9. 9

    Need only 2 digits after decimal point

  10. 10

    Excel to csv file conversion - conserve numbers after the decimal point

  11. 11

    How Edittext can accept only two numbers after decimal point

  12. 12

    JQuery allow only two numbers after decimal point

  13. 13

    Find the position of the digit after decimal point that is different between two numbers

  14. 14

    Excel to csv file conversion - conserve numbers after the decimal point

  15. 15

    Ensuring number has 2 numbers after decimal

  16. 16

    Length after decimal point

  17. 17

    UITextField accepting only one decimal point with max 3 digits before decimal point & max 2 digits after decimal point

  18. 18

    Make decimal point to whole numbers

  19. 19

    Make decimal point to whole numbers

  20. 20

    Convert floating point numbers to decimal numbers

  21. 21

    Getting numbers behind decimal separator

  22. 22

    Roman numbers to decimal numbers, getting garbage value

  23. 23

    Roman numbers to decimal numbers, getting garbage value

  24. 24

    Selecting floating point numbers in decimal form

  25. 25

    Conversion of decimal floating point numbers to binary and back

  26. 26

    how to subtract numbers with decimal point in php

  27. 27

    Aligning numbers at decimal point angular ui grid

  28. 28

    Formatting Numbers So They Align On Decimal Point

  29. 29

    Conversion of decimal floating point numbers to binary and back

HotTag

Archive