
Input from Keyboard 4.5
15. crdts = stkn.nextToken(); crdts.trim();
16. debts = stkn.nextToken();debts.trim();
17. // convert to double
18. credits = Double.parseDouble(crdts);
19. debits = Double.parseDouble(debts);
20. netPay = credits-debits;
21. JOptionPane.showMessageDialog(null,"Name "+ name +
22. "\tId Number :" + idNo +"\nCredits :" +
23. credits+"\t Debits " + debits +"\t Net Pay :"+ netPay,"Employee
Pay Bill",JOptionPane.PLAIN_MESSAGE);
24. }
25. }
Line No. 2: imports java.util.* a package housing StringTokenizer()
Line No. 11: String stg = input.readLine(); reads String input from keyboard.
Line No. 14: idNo = stkn.nextToken(); idNo.trim(); ...