subject

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

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:30
What kind of software users of all skill levels create web pages that include graphics, video, audio, animation, and other special effects? website authoring website software website publishing website editing
Answers: 1
question
Computers and Technology, 22.06.2019 20:40
Assume that there is a 4% rate of disk drive failure in a year. a. if all your computer data is stored on a hard disk drive with a copy stored on a second hard disk drive, what is the probability that during a year, you can avoid catastrophe with at least one working drive? b. if copies of all your computer data are stored on three independent hard disk drives, what is the probability that during a year, you can avoid catastrophe with at least one working drive?
Answers: 1
question
Computers and Technology, 24.06.2019 13:10
Write a program that has a conversation with the user. the program must ask for both strings and numbers as input. the program must ask for at least 4 different inputs from the user. the program must reuse at least 3 inputs in what it displays on the screen. the program must perform some form of arithmetic operation on the numbers the user inputs. turn in your .py file as well as a screenshot of your program's output. include comments in your code to explain how it works an example program run might look like (have fun with this and be creative): β€˜what is your name? ’ β€œjosh” β€˜, josh. what is your favorite color? ’ β€œgreen” β€˜mine too. do you also like ice cream? ’ β€œno” β€˜josh, how old are you? ’ β€œ40” β€˜ and how many siblings do you have? ’’ β€œ3” β€˜that means you are one of 4 kid(s). is green the favorite color of anyone else in your house? ’
Answers: 3
question
Computers and Technology, 24.06.2019 17:50
You work in the accounting department and have been using a network drive to post excel workbook files to your file server as you complete them. when you attempt to save a workbook file to the drive, you see the error message: β€œyou do not have access to the folder β€˜j: \’. see your administrator for access to this folder.” what should you do first
Answers: 2
You know the right answer?
How do you write a test program that reads in a set of octagon side values from a file, creates an O...
Questions
question
Mathematics, 17.03.2020 20:38
question
Mathematics, 17.03.2020 20:38
Questions on the website: 13722367