Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA Modify the baseball stats program Modify the test document to include a col

ID: 3819764 • Letter: J

Question

JAVA

Modify the baseball stats program

Modify the test document to include a column for home runs

update the forms, class, and file IO

Create two additional stats files for different baseball teams

Fake data is OK – just be sure to vary it greatly from what I provided

Add functionality to the menu to open different files

On opening be sure to remove the existing data in the list box

Adjust the label to reflect the team based on the file opened

Update the icon based on the team opened

Social Media Primer

Not everyone is fluent on the uses of social media. You will create a program that describes the different social media platforms to users. You program will have the following

A class that holds the icon image, name, URL, and description of a social media site.

Build a custom renderer for the class that displays the icon and the name of the site

Create a JFrame form with

A JList that holds 6 social media sites and uses the custom renderer

JLabels for the social media site name, description and the URL

Hint: if you write the url to the JLabel with HTML, the JLabel will be clickable:

labelURL.setText("<a href="" social.getURL() + "">" + social.getURL() + "</a>

When the user selects a social media site from the JList, the rest of the form updates

I found icons for social media here https://www.google.com/search?q=free+US+traffic+signs&espv=2&biw=1440&bih=794&tbm=isch&source=lnt&tbs=isz:ex,iszw:32,iszh:32#tbs=isz:ex,iszw:32,iszh:32&tbm=isch&q=social+media+icons

Explanation / Answer

import java.util.Scanner; import java.io.*; public class BaseballStats { //------------------------------------------------- // Reads baseball stats from a file and counts // total hits, outs, walks, and sacrifice flies // for each player. //------------------------------------------------- public static void main (String[] args) throws IOException { Scanner fileScan, lineScan; String fileName; Scanner scan = new Scanner(System.in); System.out.print ("Enter the name of the input file: "); fileName = scan.nextLine(); fileScan = new Scanner(new File(fileName)); // Read and process each line of the file while (fileScan.hasNext()) { fileName = fileScan.nextLine(); lineScan = new Scanner (fileName); while (lineScan.hasNext()) { lineScan.useDelimiter(","); System.out.println(" "+lineScan.next()); } } } }