Question: JAVA QUESTION How do I fix this Checkstyle error in eclipse? 20.0 is a magic number I want to re-write the the entire code shown
JAVA QUESTION
How do I fix this Checkstyle error in eclipse?
"20.0 is a magic number"
I want to re-write the the entire code shown by:
1) Define a class constant with a meaningful name to hold that value
2) now use the name of the constant in your code instead of the hard-coded value

/ round to 2 decimal number if (myMembership && total.compareTo (new BigDecimal(20.0 final BigDecimal discountRatenew BigDecimal(0.0015/ 100); final BigDecimal discountAmo final BigDecimal discountTotal- total.subtract(discountAmount); total discountTotal; unt- total.multiply(discountRate); e Bug Explorer Metrics- ssa25-shoppingcart-McCabe Cyclomatic Complexity (avg... Violations Ou Checkstyle violation "X' is a magic number." -1 occurrences In Folder Line Message urce pingCart.java/ssa25-shoppingcart/src/model
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
