Answer Posted /

Is This Answer Correct ?    Yes No

Post New Answer   View All Answers

Please Help Members By Posting Answers For Below Questions

The following program reads data (details of students) from a file named students.txt and converts it into e-mail addresses. The results are written to a file named studentemail.txt. students.txt consists of a number of lines, each containing the data of a student in colon delimited format: Last Name:First Name:Student Number Each input record is converted to an e-mail address and written to studentemail.txt in the following format: the first character of the last name + the first character of the first name + the last four digits of the student number + “” import*; public class EmailConverter { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new FileReader ("students.txt")); PrintWriter output = new PrintWriter(new FileWriter ("studentemail.txt")); String line = input.readLine(); while (line != null) { // Extract the information for each student String[] items = line.split(":"); // Generate the email address String email = "" + items[0].charAt(0) + items[1].charAt(0) + items[2].substring(4,8) + ""; email = email.toLowerCase(); // Output output.println(email); line = input.readLine(); } input.close(); output.close(); } } Rewrite the class so that it handles possible errors that may occur. In particular, it should do the following: • It should catch at least three appropriate exceptions that might occur, and display suitable messages. • At this stage, the program will not run correctly if there is an empty line in the input file. Change the program so that if an empty line is encountered, an exception is thrown and the empty line is ignored. This exception should be handled with the display of a suitable error message. • Before the e-mail address is added to the output file, check if the student number has 8 digits. If not, throw an InvalidFormatException (which the program should not handle itself)


what is the difference between electrical choke and electronic choke?


How to add 99 menu (page down) option in menu creation..


what is instance?


How do you use collections in procedure to return the resultset?


Have you ever been involved in Testing?


How do you script this scenario in QTP using VB? Verify XML attributes in XML message against XSD and data mapping of fields to Oracle tables? Verify data in XML to data in a defined table?


what is the use of sdf?


What is meant by Establish Connection in RDO?


When we run a GL Reconciliation Report, we also see the void payments in that report. Even though i disable the option of Show Void payments, its appearing in the report.How do i proceed so that i dont see those void payments in the GL Reconciliation Report?


i am shortlisted in corporation bank for the post of computer officer the next phase is group discussion. i want to know how to prepare and what about the topics for preparing thanking you if you have any suggestion please give me


R=*¶ l/a


From the following find out a. Profit Volume ratio b. Break even point c. Sales for 40% P/V Ratio d. Margin of safety from the sales Rs 3,00,000 e. Net profit from the sales of Rs 3,00,000 f. Required sales for the new profit of Rs 70,000 g. Required sales for the net profit of Rs 70,,000 after tax, the corporate income tax being 40% h. Additional sales required to convert an increase of Rs 3000 p.a. in the sales manager salary Sale 2,00,000 Variable Overheads 1,50,000 Profit 50000 Fixed overheads 15000 Net profit 35000 Sl No Heads of Account Debit Rs Credit Rs 1 Drawing and Capital 750 15,000 2 Stock as on 01.01.2009 69720 3 Bills Receivable and bills payable 1000 1180 4 Returns 300 320 5 Purchases and Sales 4500 8300 6 Wages 70 7 Discount 30 8 Salaries 200 9 Canara Bank Shares 3000 10 Insurance 120 11 Building 3000 12 Furniture 700 13 Debtors and Creditors 600 1300 14 Cash in Hand 470 15 Overdraft at bank 900


Why we use 4 - 20 ma?


What is the purpose of dfsadmin tool?