Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing the following program in Java Write a program that will read files of the above format and plot the polylines using

I need help writing the following program in Java

Write a program that will read files of the above format and plot the polylines using the plotter. You can refer to the sample code QuizAverager as a model for the file-reading loop. Start with a helper method that parses just one line and returns the corresponding Polyline object. Then write a helper method that opens and reads the file, and returns an ArrayList of Polyline objects:

private static ArrayList readFile(String filename)

throws FileNotFoundException

{

}

Then the main method can iterate over the list, and call plot() for each Polyline.

Then, try it on the file hello.txt.

The hello.txt file is below

# mystery drawing! 4 red 105 153 105 152 105 155 103 161 100 174 97 188 91 212 89 233 88 257 88 275 88 297 88 315 88 328 88 337 88 344 88 350 89 353 89 354 89 355 red 90 253 91 252 94 252 98 252 104 252 114 252 123 252 133 252 146 252 157 252 165 252 173 252 178 252 181 252 183 252 184 252 185 252 186 252 188 252 190 252 4 red 196 169 196 171 193 179 191 186 188 198 186 209 185 222 185 234 185 247 185 257 185 265 185 274 185 283 184 293 183 301 183 307 182 314 182 318 182 321 182 325 181 328 181 330 181 332 181 334 181 335 181 336 181 337 181 338 181 340 181 342 181 346 181 347 181 348 181 348 180 348 180 349 180 350 180 351 180 352 2 green 218 312 219 312 225 313 227 313 232 313 237 313 240 313 243 313 245 311 246 309 246 306 246 303 246 299 246 297 246 295 246 293 246 291 246 290 246 289 246 288 245 287 242 285 239 284 234 283 230 283 226 283 223 283 220 283 218 284 215 286 213 288 209 291 206 293 204 296 202 298 201 299 201 300 201 302 201 305 201 309 201 314 201 318 203 324 204 328 207 333 210 337 213 340 216 343 220 344 224 346 229 346 233 346 238 346 241 346 245 346 247 346 249 346 250 346 251 346 252 346 253 345 255 344 255 344 4 blue 292 192 292 193 292 198 291 209 289 222 287 239 285 257 285 273 285 291 285 306 285 320 284 334 284 347 284 358 284 365 284 372 284 377 284 379 284 381 4 magenta 341 194 341 195 341 199 341 204 341 211 340 225 340 236 340 251 339 265 339 280 339 293 339 305 339 315 339 325 339 332 339 337 339 344 339 351 339 353 339 355 339 357 2 orange 404 301 402 301 400 301 399 301 397 301 394 301 391 301 388 301 386 301 385 301 383 303 383 307 382 311 382 316 382 322 382 329 382 335 382 343 382 349 382 354 384 359 387 365 390 368 393 371 397 374 403 375 409 376 416 376 424 376 432 373 438 368 443 363 448 357 451 350 454 344 454 340 455 335 455 331 455 327 453 323 451 317 448 311 445 306 443 303 440 301 436 299 432 297 429 297 426 297 424 297 423 297 422 297 421 297 419 296 417 296 416 296 416 296 415 296 414 296 413 296 412 296 412 296 411 296 411 297 410 297 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions