PRG/420 Week 5 Exception Handling JAVA Program
Everything listed below is INCLUDED in purchase! A+ Work! PRG/420 Week 5 Everything listed for Week 5 is included in purchase!! Get ALL Assignments for the week for one LOW Price! Learning Team: FAQ: Exceptions and Strings Answer the following questions as a team: 1. When would a programmer use String vs. StringBuilder? 2. What are Java™ exceptions, and why should programmers handle them? 3. What is the difference between a Java™ error and a Java™ exception? 4. What is the difference between a checked exception and an unchecked exception? After your team has finished answering the questions collectively, add them, along with the question text, to your Java FAQ document. Refer to the Week 1 Task, "Learning Team: Formatting a Java™ FAQ". The team member responsible for submitting the team's work will submit the formatted FAQ document containing this week's questions and answers using the Assignment Files tab. Individual: Analyzing a Program Containing Exception Handling Includes Working Java Build and Program File and Explanation of Code Resource: Week Five Analyze Assignment Zip File For this assignment, you will be analyzing the code in the linked Week Five Analyze Assignment Zip File. This program contains exception handling code. You will be evaluating the code and using what you learned in this week's readings to predict the results based on the program as written, as well as based on changing the value of a specific variable. Carefully read through the code line by line, then answer the following questions in a Microsoft® Word document: 1. What are the results of the program as written? 2. What results would the program produce if you changed the value of a from 0 to 3? Submit your completed Word document using the Assignment Files tab. Individual: Coding a Program Containing Exception Handling Includes Working Java Build and Program File and Explanation of Code Resource: Week Five Coding Assigment Zip File (starter code for this assignment that includes placeholders) For this assignment, you will apply what you learned in analyzing a simple Java™ program by writing your own Java™ program. The Java™ program you write should do the following: • Organize the code capable of throwing an exception of type ParseException as a try block. • Include a catch block to handle a ParseException error thown by the try block. • Include a hard-coded error that results in a ParseException to prove that the code can catch and handle this type of exception. Complete this assignment by doing the following: 1. Download and unzip the linked Week Five Coding Assigment Zip File. 2. Add comments to the code by typing your name and the date in the multi-line comment header. 3. Replace the following lines with Java™ code as directed in the file: • LINE 1 • LINE 2 4. Replace the value assigned with one of the variables so that the program throws an exception. 5. Comment each line of code you add to explain what you intend the code to do. Be sure to include a comment for the replacement value you added in Step 4 that causes the program to throw an exception. 6. Test and modify your Java™ program until it runs without errors and produces the results described above. Note: Refer to this week's analyzing code assignment if you need help. Submit your Java application file using the Assignment Files tab. Discussion Question: Comparisons of Time and Date This week's supporting activity asks you to create a simple Java™ app that identifies and displays information about the current date, time, and day of week. If you were not able to complete the Supporting Activity, "Working with Dates," successfully, post the problems you are having with the code. What compiler error appears? If your code compiles, what incorrect output appears? If you were able to complete the Supporting Activity, "Working with Dates," successfully, help your classmates who are having difficulties. Research and discuss how you could add to the supporting activity's code by including this comparison: If today's date is later than January 1, 1980, display "Today is later than January 1, 1980" on the console. If today's date is earlier than January 1, 2020, display "Today is earlier than January 1, 2020" on the console. What Java™ methods would you use to code these new requirements? If you get one or both of these comparisons to work, post the code for your classmates to see.
0.09MB ZIP File