
4.6 Simple IO and Arrays and String Vectors
8. int idNo;
9. double credits,debits,netPay;
10. System.out.println(“Enter Emp name, idNo,credits,debits
separated by spaces”);
11. Scanner scn = new Scanner(System.in);
12. name = scn.next();
13. idNo = scn.nextInt();
14. credits = scn.nextDouble();
15. debits = scn.nextDouble();
16. netPay = credits-debits;
17. JOptionPane.showMessageDialog(null,”Name “+ name +
18. “\tId Number :” + idNo +”\nCredits :” +
19. credits+”\t Debits “ + debits +”\t Net Pay :”+
20. netPay,”Employee Pay Bill”,JOptionPane.PLAIN_MESSAGE);
21. }
22. }
Line No. 2: java.util.* for Scanner class.
Line No. 11: Scanner scn ...