Computers and Technology

How do you write a test program that reads in a set of octagon side values from a file, creates an Octagon using the side, and adds them to list: ArrayList . Print the unsorted list, sort the list using java. util. Collections. sort(list), then print the sorted list(format your output). Provide exception handling for your files as well as for the input including FileNotFound exception and IllegalArgumentException. If invalid input is encountered (note highlighted data item), report the invalid value and then continue reading in the next value. With this: Algorithm for test program
Main:
declare list as ArrayList of Octagon
print Name, Lab Number, and Date
open data. txt as input
while input not EOF:
side = Double. parseDouble(input. next())
anOctagon = new Octagon(side)
list. add(anOctagon)
end while

print(list) //side, area, and perimeter for each Octagon
sort(list)
print(list) //side, area, and perimeter for each Octagon
close file
print end of program message

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:20, owoeli
Which of these is a benefit of social networking? oa. hiding your true identity from friendsob. avoiding talking to people in personoc. spending time with friends instead of studyingod. connecting with new people
Answers: 2
image
Computers and Technology, 22.06.2019 17:30, uh8hardiek
Ou listened to a song on your computer. did you use hardware or software?
Answers: 2
image
Computers and Technology, 22.06.2019 18:00, crimhill
When is it appropriate to use an absolute reference
Answers: 1
image
Computers and Technology, 22.06.2019 19:30, tfaulk2884
Singing in the rain: this first part of the film shows the early history of motion picture. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theater productions? explain.
Answers: 1
Do you know the correct answer?
How do you write a test program that reads in a set of octagon side values from a file, creates an O...

Questions in other subjects: