subject

Design, implement and test a Java class that processes a series of triangles. The triangle specification will be identical to that in Programming Assignment #2 (part A). As in that assignment, you will read in the three sides of the triangle, check the input for errors (and handle them if found), classify the triangle and compute its area. For this assignment, triangle data will be read from an input file and the program’s output will be written to another file. The output file will also include a summary of the data processed. You must use at least one dialog box in this program. The data for each triangle will be on a separate line of the input file, with the input data echoed and the results referred to by the line number (see example).
Some things to note:
• All input data lines must be processed.
• A new line with triangle data always starts with the ‘#’ marker.
• If an error is encountered on a given line, it must be handled. Afterwards, the program will continue on the next line without processing the triangle. An example of such an error is a non-integer appearing in the first three values of a given line.
• Extraneous data must be discarded. This is data that appears after the first three triangle sides are found, but before a new triangle marker is found.
• If the end of file (EOF) is found, a message should be printed out
• There shall be no unhandled file related exceptions and an end-of-file exception must be avoided.

On initialization, the program will prompt the user for both an input and an output file. If a non-existent input file is specified, the appropriate exception must be handled, resulting in an error message. For the exception case, re-prompt the user for the correct input file [Extra credit if you implement a JFileChooser type dialog box]. Once the I/O file is specified, the program will read in and process all the entries in the file. The output of the program will be written to the specified output file and echoed to the console.

The program will evaluate each line and determine the validity of the triangle. If valid, the program will output summary line for the triangle calculation (see Programming Assignment #2A). If invalid, the program will output a description of the error found in the entry. Your program must be robust and handle situations where all the triangle inputs are not proper and/or present.

Once all the entries are processed, a summary will be generated providing the following information:
• Pathname of the input file
• Number of lines processed
• Number of valid triangles
• Number of invalid triangles

You should be able to reuse much of your Programming Assignment #2A code for this project. However, strongly recommend that you rewrite your code and put this functionality in separate method(s). Likewise, any residual problems from #2A should be fixed in this version. The main features you will be adding are:

• Multiple methods
• Exception handing
• File I/O
• Dialog box

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:00
What is stored in str after the following code executes? string str = "computer science"; int i = 0; while (i < 8) { if (str.indexof("m") < i) { str = str.substring(0, 2) + str; } i += 2; } computer science cocomputer science cococomputer science cocococomputer science computer scienceco
Answers: 3
question
Computers and Technology, 21.06.2019 18:10
For each of the following claims, determine whether they are true or false. justify your determination (show your work). if the claim is false, state the correct asymptotic relationship as o, θ, or ω. unless otherwise specified, lg is log2.(a) (b) (c) (d) (e) (f) (g) (h) (i) (j)n+1 =22n =2n =1 =ln2 n =n2 +2n−4 =33n = 2n+1 =√n = 10100 =o(n4) o(2n)θ(2n+7 ) o(1/n)θ(lg2 n) ω(n2 )θ(9n ) θ(2n lg n )o(lg n) θ(1)
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
Martha is a healer, a healthcare provider, and an experienced nurse. she wants to share her daily experiences, as well as her 12 years of work knowledge, with people who may be interested in health and healing. which mode of internet communication can martha use?
Answers: 3
question
Computers and Technology, 23.06.2019 07:10
If you want to import a picture into a dtp application, what must you do first? draw an image frame. import text. open the folder containing the file. select get image… from the windows menu.
Answers: 2
You know the right answer?
Design, implement and test a Java class that processes a series of triangles. The triangle specifica...
Questions
question
Physics, 23.05.2020 05:03