Package java.util

Examples of java.util.Scanner.nextDouble()


        System.out.print("Enter the amount: "); //Ask user for end amount
        amount = input.nextDouble(); //Collect end amount
        System.out.print("Enter the number of years: "); //Ask user for year amount
        years = input.nextDouble(); //Collect year amount
        System.out.print("Enter the interest rate: "); //Ask user for interest amount
        interest = input.nextDouble(); //Collect interest amount
        principal = amount / (1 + years * interest); //Calculate start amount
        System.out.print("The amount needed is: " + money.format(principal)); //Print end amount formated as currency
        }
    } //end class definition
View Full Code Here


        }
        if (action.equalsIgnoreCase("E")) {
          System.out.println(emp);
        } else if (action.equalsIgnoreCase("P")) {
          System.out.print("Enter the hours for associate or pay period for manager: ");
          payArg = input.nextDouble();
          payEmployee(emp, payArg);
        }
      }
    } while (!action.equalsIgnoreCase("Q"));
  }
View Full Code Here

        double principal; //Variable to hold first amount
        double years;     //Variable to hold year  amount
        double interest;  //Variable to hold interest amount
        double amount;    //Variable to hold end   amount
        System.out.print("Enter the principal: "); //Ask user for first amount
        principal = input.nextDouble(); //Collect first amount
        System.out.print("Enter the number of years: "); //Ask user for year amount
        years = input.nextDouble(); //Collect year amount
        System.out.print("Enter the interest rate: "); //Ask user for interest amount
        interest = input.nextDouble(); //Collect interest amount
        amount = principal * (1 + years * interest); //Calculate end amount
View Full Code Here

        double interest;  //Variable to hold interest amount
        double amount;    //Variable to hold end   amount
        System.out.print("Enter the principal: "); //Ask user for first amount
        principal = input.nextDouble(); //Collect first amount
        System.out.print("Enter the number of years: "); //Ask user for year amount
        years = input.nextDouble(); //Collect year amount
        System.out.print("Enter the interest rate: "); //Ask user for interest amount
        interest = input.nextDouble(); //Collect interest amount
        amount = principal * (1 + years * interest); //Calculate end amount
        System.out.print("The value after the term is: " + money.format(amount)); //Print end amount formated as currency
        }
View Full Code Here

        System.out.print("Enter the principal: "); //Ask user for first amount
        principal = input.nextDouble(); //Collect first amount
        System.out.print("Enter the number of years: "); //Ask user for year amount
        years = input.nextDouble(); //Collect year amount
        System.out.print("Enter the interest rate: "); //Ask user for interest amount
        interest = input.nextDouble(); //Collect interest amount
        amount = principal * (1 + years * interest); //Calculate end amount
        System.out.print("The value after the term is: " + money.format(amount)); //Print end amount formated as currency
        }
    } //end class definition
View Full Code Here

    System.out.print("First name: ");
    fName = input.nextLine();
    System.out.print("Last name: ");
    lName = input.nextLine();
    System.out.print("Beginning balance: ");
    bal = input.nextDouble();
   
    newAcct = new Account(bal, fName, lName)//create account object
    accounts.add(newAcct);            //add account to bank accounts
    numAccts += 1;                //increment number of accounts
   
View Full Code Here

        NumberFormat percent = NumberFormat.getPercentInstance();
       
        System.out.println("Please enter 5 grades."); //Ask User for 5 grades
        while (num < 5) { //do this while var num is less than 5
            System.out.print("#"+(num+1)+": "); //Ask for grade
            grade += input.nextDouble(); //Add grade to others
            num++; //add 1 to var num
        } //end while
        System.out.println("Grade Average: " + percent.format(grade / 5)); //Display Average Grade
        } //end main
    } //end class definition
View Full Code Here

      } else if (!action.equalsIgnoreCase("Q")) {
        System.out.print("Enter account ID: ");
        acctID = input.next();
        if (action.equalsIgnoreCase("D")) {
          System.out.print("Enter deposit amount: ");
          amt = input.nextDouble();
          easySave.transaction(1, acctID, amt);
        } else if (action.equalsIgnoreCase("W")) {
          System.out.print("Enter withdrawal amount: ");
          amt = input.nextDouble();
          easySave.transaction(2, acctID, amt);
View Full Code Here

          System.out.print("Enter deposit amount: ");
          amt = input.nextDouble();
          easySave.transaction(1, acctID, amt);
        } else if (action.equalsIgnoreCase("W")) {
          System.out.print("Enter withdrawal amount: ");
          amt = input.nextDouble();
          easySave.transaction(2, acctID, amt);
        } else if (action.equalsIgnoreCase("C")) {
          easySave.checkBalance(acctID);
        } else if (action.equalsIgnoreCase("R")) {
          easySave.deleteAccount(acctID);
View Full Code Here

    NumberFormat money = NumberFormat.getCurrencyInstance();
   
    System.out.println(munozAccount);
   
    System.out.print("Enter deposit amount: ");
    data = input.nextDouble();
    munozAccount.deposit(data);
    System.out.println("Balance is: " + money.format(munozAccount.getBalance()));

    System.out.print("Enter withdrawal amount: ");
    data = input.nextDouble();
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.