Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Please write the expected code; Coordinates for coordinates1.txt ; 281 240 353 238 264 243 458 361 794 565 574 457 289 189 458 345

Please write the expected code;

image text in transcribed

image text in transcribed

Coordinates for coordinates1.txt ;

281 240 353 238 264 243 458 361 794 565 574 457 289 189 458 345 304 288 298 238 339 263 595 394 288 265 501 367 682 504 96 85 139 117 761 516 782 533 202 151 228 206 671 452 642 482 296 238 290 240 217 162 208 133 796 466 37 141 541 401 401 344 91 108 369 233 575 369 768 484 423 240 748 528 792 505 373 291 291 237 72 82 675 502 331 266 606 376 443 322 381 296 213 171 108 133 62 134 677 478 270 253 539 440 84 158 470 351 92 162 199 132 331 258 572 421 696 486 652 442 186 107 277 226 768 482 241 184 123 157 596 390 226 219 263 193 1 117 451 361 355 238 129 158 563 464 435 240 204 166 314 209 196 186 466 364 42 90 482 348 32 88 690 440 274 193 90 136 475 327 504 406 625 464 589 383 633 449 519 392 730 502 485 332 589 443 571 494 552 392 736 516 776 572 263 203 76 78 645 450 546 321 139 116 385 262 751 540 110 109 528 348 155 136 501 342 497 393 353 259 527 345 358 295 681 479 566 421 343 246 496 315 513 374 710 483 795 534 583 394 405 312 39 85 87 105 687 460 733 425 537 418 370 303 769 518 64 166 309 280 13 50 474 295 455 299 10 30 472 357 288 234 20 115 783 492 106 131 440 329 691 461 546 348 28 106 352 331 352 296 613 446 800 502 206 200 709 529 40 109 265 222 584 400 399 315 437 290 180 124 98 67 388 282 699 453 513 402 359 268 110 149 113 59 786 511 778 496 343 288 605 436 447 413 605 481 781 571 33 66 281 145 381 305 140 140 285 221 711 536 55 0 74 88 165 95 492 315 219 202 598 447 245 196 612 401 202 229 537 394 106 150 754 544 356 312 286 307 136 162 399 319 362 287 53 108 710 484 726 494 626 441 378 217 637 477 701 500 538 390 56 117 100 102 340 234 626 452 471 376 378 302 27 66 144 99 745 533 473 360 405 342 175 179 762 504 290 247 367 285 665 415 633 426 353 251 499 343 764 509 531 349 213 194 579 415 449 315 778 513 241 259 398 339 227 162 59 112 89 98 60 83 797 514 480 302 631 473 689 414 662 452 750 515 29 26 112 151 580 412 698 472 299 223 173 153 461 354 21 14 35 93 747 463 321 248 628 469 194 206 487 324 715 496 504 322 739 500 797 575 120 75 20 123 729 518 118 90 72 155 573 421 140 169 128 144 383 287 759 549 593 380 538 330 56 86 245 204 749 478 686 477 713 507 471 370 130 176 141 138 598 403 756 508 526 362 435 317 478 376 188 168 656 452 631 394 471 314 349 327 440 309 282 160 797 529 292 197 773 500 20 84 622 474 352 305 504 310 251 262 737 451 179 217 300 211 247 199 30 157 484 368 669 516 471 349 291 306 112 133 93 104 785 465 433 358 69 115 205 174 168 210 252 261 723 462 417 299 130 97 115 156 51 81 684 479 780 513 743 532 328 262 721 503 388 331 376 279 134 71 66 126 507 376 249 223 373 298 169 185 1 96 638 444 294 214 12 104 572 388 175 136 551 416 197 206 213 171 106 155 275 233 604 477 711 486 568 399 197 179 361 342 745 491 493 347 207 192 505 376 556 359 323 236 155 103 246 182 554 386 504 344 200 112 35 72 425 278 141 112 418 310 697 470 491 350 217 193 684 474 126 117 208 215 536 440 181 128 661 418 259 208 391 228 611 408 590 344 509 336 199 139 587 419 272 210 242 214 102 143 8 91 740 467 728 530 306 235 561 434 538 414 102 106 161 210 722 526 713 495 302 227 200 188 482 397 500 335 16 40 656 462 414 320 728 519 95 132 757 482 742 568 76 126 332 270 258 229 677 481 758 539 583 426 547 373 513 342 253 165 586 380 126 113 608 471 74 131 774 543 487 391 716 514 155 139 790 499 193 193 179 214 322 201 625 403 671 410 328 230 322 218 617 479 199 157 693 445 546 407 782 562 148 110 173 140 250 189 602 407 294 232 484 343 307 240 440 329 308 246 532 378 12 89 650 432 280 233 572 404 767 463 406 311 533 359 344 269 680 451 523 404 403 273 295 205 548 369 79 93 38 98 695 468 521 314 488 387 338 250 403 300 131 122 75 115 548 379 114 105 423 296 3 132 340 259 179 153 528 356 402 313 480 336 160 173 110 133 19 65 752 482 556 418 443 347 236 191 34 44 683 520 477 384 15 99 747 503 8 103 513 402 631 445 421 312 233 182 503 345 340 223 437 373 153 173 596 425 170 109 80 144 717 484 658 463 706 515 70 123 

In this assignment, you will find a best fit line to a given 2D point set. Point coordinates -(x, y) pairs- are provided in a text file: coordinates.txt. Each (x, y) point should be stored as a PointXY object. UML diagram for the PointXY class is provided in Figure 1. In the input coordinates file, there are many 2D points. You are required to store all of these points in an Array List, of type PointXY. You are given three coordinate files. Figure 2,3, and 4 show the results of the best fitting line (black line) and input point sets (randomly colored circles, opacity-0.7). As seen in figures, if the points are close to linear, line fits correctly. If the points are non-linear, fitting a line seems inadequate. PointXY +x: int +y: int +PointXY(x: int, y: int) x coordinate value y coordinate value Constructor Figure 1. UML class diagram of the PointXY class. Given a set of n points (x1.y), (x2,Y2), found by , (xn.yn), equation of a best fitting line y ax b can be where- -4:1 y and X =?4:1 X are the means of x and y coordinate values given in the coordinate file. When you run your program with a specified input file, e.g., coordinates1.txt, it should output plots as shown in figures given below. Provide all three output plots in your report. Tip: In order to draw all points within the output window, automatically calculate scene width and height parameters for the Scene constructor using minimum and maximum (x, y) coordinates. Scene scene = new Scene (pane, scen ewidth, sceneHeight); In this assignment, you will find a best fit line to a given 2D point set. Point coordinates -(x, y) pairs- are provided in a text file: coordinates.txt. Each (x, y) point should be stored as a PointXY object. UML diagram for the PointXY class is provided in Figure 1. In the input coordinates file, there are many 2D points. You are required to store all of these points in an Array List, of type PointXY. You are given three coordinate files. Figure 2,3, and 4 show the results of the best fitting line (black line) and input point sets (randomly colored circles, opacity-0.7). As seen in figures, if the points are close to linear, line fits correctly. If the points are non-linear, fitting a line seems inadequate. PointXY +x: int +y: int +PointXY(x: int, y: int) x coordinate value y coordinate value Constructor Figure 1. UML class diagram of the PointXY class. Given a set of n points (x1.y), (x2,Y2), found by , (xn.yn), equation of a best fitting line y ax b can be where- -4:1 y and X =?4:1 X are the means of x and y coordinate values given in the coordinate file. When you run your program with a specified input file, e.g., coordinates1.txt, it should output plots as shown in figures given below. Provide all three output plots in your report. Tip: In order to draw all points within the output window, automatically calculate scene width and height parameters for the Scene constructor using minimum and maximum (x, y) coordinates. Scene scene = new Scene (pane, scen ewidth, sceneHeight)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions