Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static final double RATE_BV = 0.15;

    /**
     * Calculate total value (dollar) fro BV point
     * 
     * @param bv
     * @return
     */
    public static String calBVtoDollar(String bv) {
        float bv_f = convertStringToFloat(bv);
        return String.format("%.02f", (bv_f * RATE_BV));
    }

    public static float convertStringToFloat(String s) {
        try {
            return Float.parseFloat(s);
        } catch (Exception e) {
            return 0;
        }
    }
}