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 12:10
1. declare a constant named cents_per_pound and initialize with 25. 2. get the shipping weight from user input storing the weight into shipweightpounds. 3. using flat_fee_cents and cents_per_pound constants, assign shipcostcents with the cost of shipping a package weighing shipweightpounds.
Answers: 2
question
Computers and Technology, 22.06.2019 19:30
Once the data center routes to the destination server that hosts the website, what's the next step in the internet process? user’s browser renders html code from destination server into web page request goes through router/model and isp request routed to nameserver and datacenter
Answers: 2
question
Computers and Technology, 22.06.2019 23:50
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
question
Computers and Technology, 24.06.2019 19:50
How to unblock on chrome book? ?
Answers: 1
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
Questions on the website: 13722363