ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 12 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 09 May 2017 My Price 9.00

write a Java program that produces a simple formatted report

For this lab you will write a Java program that produces a simple formatted report. The program will prompt the user to enter a file name. This file must contain information in a specific format (detailed below). Each "block" of the file contains information for one player in a competition -- the name of the player followed by a number of different scores that that player achieved. The program should find each player's average score, median score and best and worst scores and display them in a line on the final summary report. The program should also determine which player has the highest average score and which player has the lowest average score. (HINT: Consider storing information in ArrayLists to make the final summaries easier to produce). For this assignment you should start with the following "skeleton" of Java code. Import this into your Eclipse workspace and fill in the methods as directed. The skeleton provided for this assignment is much more "skeletal" than previous assignments. For this assignment you MUST add at least two extra methods beyond the methods defined in the skeleton. These methods must not be trivial one or two line methods, but a real breakdown of the code. Consider adding methods to write the formatted report, or helper methods for reading the input file or computing necessary values. Feel free to add any methods you find useful, and make sure that you add comments indicating what they do following the form of the rest of the comments in the code. Project11.java Input File Format Your program needs to read files in a specific format. Each player is designated by a block of lines that follow the following format: ... -1 Where the elipses (...) indicate more scores are possible, though not required. A minimum of one score per player is required. Multiple blocks appended together form the whole file. For example, the following sample shows four players and their associated scores: Rory Williams 88 92 78 -1 James Barnes 87 76 91 54 66 -1 Sarah Jane Smith 92 86 95 85 82 -1 Jack Sparrow 18 54 13 0 -1 Note that different players will have different numbers of scores, but after the last score for a player there will always be a line with a negative number. Your code must be able to take this into account and not assume that every player will have the same number of scores. A sample text file containing example scores can be found at the link below. Make sure your code works with ANY input file we might use that follows the same format. We will test your code with files other than the one provided below. project11Input.txt Output Report Format Your program should generate a text file that follows a specific reporting format. For the sample file given above, here is a sample output report: Final Overall Scores Report Name Mean Median Max Min ------------------ ------ ------ ---- ---- Rory Williams 86 88 92 78 James Barnes 74 76 91 54 Sarah Jane Smith 88 86 95 82 Jack Sparrow 21 15 54 0 Total number of participants: 4 Highest average score: Sarah Jane Smith (88) Lowest average score: Jack Sparrow (21) Note that for this assignment you must be able to compute the Mean (average) of a list of scores and the Median of the same list of scores. The Mean can be found by adding together all of the scores and then dividing by the total number of scores (so Rory Williams's Mean is computed as (88+92+78)/3 = 86). A simple algorithm for finding the median of a list of numbers is: Sort the list If the list has an odd number of elements The median is the value in the exact center of the sorted list If the list has an even number of elements The median is the average of the two elements in the middle of the list So Rory Williams's Median can be computed by putting his scores in order: [78, 88, 92] and seeing that 88 is in the center of the list. Jack Sparrow's median can be found by putting his scores in order: [0,13,18,54] and taking the average of the middle two elements (13+18)/2 = 31/2 = 15 in integer math. HINT: You may want to use the method Collections.sort() to sort your ArrayList of scores. HINT 2: The formatting of the report is important. Make sure that your output lines up appropriately regardless of the scores that the players get. In particular, make sure that single digit scores and scores of 100 line up appropriately. You may want to use a formatted output method such as printf() or format() to make your report print appropriately

Answers

(11)
Status NEW Posted 09 May 2017 05:05 AM My Price 9.00

-----------

Attachments

file 1494307832-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)