Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

This is using c# language 1) Write a program using the file Baseball.xml that lists the teams in a list box when the form loads.

This is using c# language

1) Write a program using the file Baseball.xml that lists the teams in a list box when the form loads. Each team should only appear once in the list box. Add a data grid view to your form from the toolbox and name it dgvBaseball.

2) When the user selects a team from the list box, the data grid should display only team members whose batting average is greater than his teams overall batting average, in decreasing order.This means that you will need to calculate the average for the entire team using a LINQ statement, then create a second LINQ statement that uses that average in the WHERE clause to select only team members whose batting average is greater than the entire team average. For the Data Grid View, once you write your LINQ statement, the data from the query can easily be displayed in the data grid view as shown in the code below:

var myQuery = from (your LINQ statement)

dgvBaseball.DataSource = myQuery.ToList(); dgvBaseball.Columns[0].HeaderText = "Player"; dgvBaseball.Columns[1].HeaderText = "Batting Average";

Below is the xml file code. All I need is the code. I can handle the list box and the data grid view. Just need the code. The xml file is for you so you can write the code.

Thanks.

A. J. Pierzynski White Sox 479 133 Aaron Hill Diamondbacks 609 184 Adam Dunn White Sox 539 110 Adam Jones Orioles 648 186 Adam LaRoche Nationals 571 155 Adrian Beltre Rangers 604 194 Adrian Gonzalez Dodgers 629 188 AJ Ellis Dodgers 423 114 Albert Pujols Angels 607 173 Alberto Callaspo Angels 457 115 Alcides Escobar Royals 605 177 Alejandro De Aza White Sox 524 147 Alex Gordon Royals 642 189 Alex Rios White Sox 605 184 Alex Rodriguez Yankees 463 126 Alexei Ramirez White Sox 593 157 Alfonso Soriano Cubs 561 147 Allen Craig Cardinals 469 144 Andre Ethier Dodgers 556 158 Andrew McCutchen Pirates 593 194 Angel Pagan Giants 605 174 Aramis Ramirez Brewers 570 171 Asdrubal Cabrera Indians 555 150 Austin Jackson Tigers 543 163 B. J. Upton Rays 573 141 Ben Revere Twins 511 150 Ben Zobrist Rays 560 151 Billy Butler Royals 614 192 Brandon Phillips Reds 580 163 Brennan Boesch Tigers 470 113 Brett Lawrie Blue Jays 494 135 Bryce Harper Nationals 533 144 Buster Posey Giants 530 178 Cameron Maybin Padres 507 123 Carlos Beltran Cardinals 547 147 Carlos Gonzalez Rockies 518 157 Carlos Lee Marlins 550 145 Carlos Pena Rays 497 98 Carlos Santana Indians 507 128 Chase Headley Padres 604 173 Chris Davis Orioles 515 139 Chris Johnson Diamondbacks 488 137 Coco Crisp Athletics 455 118 Cody Ross Red Sox 476 127 Colby Rasmus Blue Jays 565 126 Corey Hart Brewers 562 152 Curtis Granderson Yankees 596 138 Dan Uggla Braves 523 115 Daniel Murphy Mets 571 166 Danny Espinosa Nationals 594 147 Darwin Barney Cubs 548 139 David DeJesus Cubs 506 133 David Freese Cardinals 501 147 David Murphy Rangers 457 139 David Wright Mets 581 178 Dayan Viciedo White Sox 505 129 Delmon Young Tigers 574 153 Denard Span Twins 516 146 Derek Jeter Yankees 683 216 Desmond Jennings Rays 505 124 Dexter Fowler Rockies 454 136 Drew Stubbs Reds 493 105 Dustin Ackley Mariners 607 137 Dustin Pedroia Red Sox 563 163 Edwin Encarnacion Blue Jays 542 152 Elvis Andrus Rangers 629 180 Eric Hosmer Royals 535 124 Erick Aybar Angels 517 150 Freddie Freeman Braves 540 140 Garrett Jones Pirates 475 130 Gordon Beckham White Sox 525 123 Hanley Ramirez Dodgers 604 155 Howard Kendrick Angels 550 158 Hunter Pence Giants 617 156 Ian Desmond Nationals 513 150 Ian Kinsler Rangers 655 168 Ichiro Suzuki Yankees 629 178 Ike Davis Mets 519 118 J. J. Hardy Orioles 663 158 Jamey Carroll Twins 470 126 Jason Heyward Braves 587 158 Jason Kipnis Indians 591 152 Jason Kubel Diamondbacks 506 128 Jay Bruce Reds 560 141 Jeff Francoeur Royals 561 132 Jemile Weeks Athletics 444 98 Jesus Montero Mariners 515 134 Jhonny Peralta Tigers 531 127 Jimmy Rollins Phillies 632 158 Joe Mauer Twins 545 174 Jon Jay Cardinals 443 135 Jordan Pacheco Rockies 475 147 Jose Altuve Astros 576 167 Jose Reyes Marlins 642 184 Josh Hamilton Rangers 562 160 Josh Reddick Athletics 611 148 Josh Willingham Twins 519 135 Justin Morneau Twins 505 135 Justin Smoak Mariners 483 105 Justin Upton Diamondbacks 554 155 Kelly Johnson Blue Jays 507 114 Kendrys Morales Angels 484 132 Kevin Youkilis White Sox 438 103 Kyle Seager Mariners 594 154 Marco Scutaro Giants 620 190 Mark Reynolds Orioles 457 101 Mark Teixeira Yankees 451 113 Mark Trumbo Angels 544 146 Martin Prado Braves 617 186 Matt Holliday Cardinals 599 177 Matt Wieters Orioles 526 131 Michael Bourn Braves 624 171 Michael Brantley Indians 552 159 Michael Saunders Mariners 507 125 Michael Young Rangers 611 169 Miguel Cabrera Tigers 622 205 Miguel Montero Diamondbacks 486 139 Mike Aviles Red Sox 512 128 Mike Moustakas Royals 563 136 Mike Trout Angels 559 182 Neil Walker Pirates 472 132 Nelson Cruz Rangers 585 152 Nick Swisher Yankees 537 146 Norichika Aoki Brewers 520 150 Omar Infante Tigers 554 152 Paul Goldschmidt Diamondbacks 514 147 Paul Konerko White Sox 533 159 Pedro Alvarez Pirates 525 128 Prince Fielder Tigers 581 182 Rafael Furcal Cardinals 477 126 Rickie Weeks Brewers 588 135 Robinson Cano Yankees 627 196 Ryan Braun Brewers 598 191 Ryan Doumit Twins 484 133 Ryan Zimmerman Nationals 578 163 Shane Victorino Dodgers 595 152 Shin-Soo Choo Indians 598 169 Starlin Castro Cubs 646 183 Torii Hunter Angels 534 167 Yadier Molina Cardinals 505 159 Yoenis Cespedes Athletics 487 142 Yonder Alonso Padres 549 150 Yunel Escobar Blue Jays 558 141 Zack Cozart Reds 561 138

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_2

Step: 3

blur-text-image_3

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

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students explore these related Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 3 weeks ago