Package java.util

Examples of java.util.Scanner.nextBigDecimal()


    while (s.hasNext () && runsLeft > 0)
      {
  failed = false;
  fund = s.hasNextBigDecimal();
  myHarness.check(fund, "hasNextBigDecimal()");
  tmpDec = s.nextBigDecimal ();
  myHarness.check(tmpDec, decimals[i], tmpDec + " == " + decimals[i]);
  fund = s.hasNextBigInteger();
  myHarness.check(fund, "hasNextBigInteger()");
  tmpInt = s.nextBigInteger ();
  myHarness.check(tmpInt, integers[i], tmpInt + " == " + integers[i]);
View Full Code Here


public class Main {
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
   
    while (cin.hasNext()) {
      BigDecimal x = cin.nextBigDecimal();
      int n = cin.nextInt();
      String rv = x.pow(n).stripTrailingZeros().toPlainString();
      if (rv.startsWith("0.")) {
        rv = rv.substring(1);
      }
View Full Code Here

      System.out.print("Enter a BigDecimal: ");
      while( !input.hasNextBigDecimal() ) {
        input.nextLine();
        System.out.print("Not a BigDecimal, try again: ");
      }
      System.out.println( "You entered: " + input.nextBigDecimal() );
     
      System.out.println( "Enter a long: " );
      while( !input.hasNextLong() ) {
        input.nextLine();
        System.out.println( "Not a long, try again" );
View Full Code Here

                return stringVal.trim();
            }
            return DataTypeFactory.getInstance().fromDescription("date", database).sqlToObject(stringVal, database);
        } else if ((liquibaseDataType instanceof DecimalType || typeId == Types.DECIMAL)) {
            if (scanner.hasNextBigDecimal()) {
                return scanner.nextBigDecimal();
            } else {
                return new DatabaseFunction(stringVal);
            }
        } else if (typeId == Types.DISTINCT) {
            return new DatabaseFunction(stringVal);
View Full Code Here

            return stringVal;
        } else if (typeId == Types.NULL) {
            return null;
        } else if ((liquibaseDataType instanceof NumberType || typeId == Types.NUMERIC)) {
            if (scanner.hasNextBigDecimal()) {
                return scanner.nextBigDecimal();
            } else {
                return new DatabaseFunction(stringVal);
            }
        } else if (liquibaseDataType instanceof NVarcharType || typeId == Types.NVARCHAR) {
            return stringVal;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.