Question
In Javascript Write a test program that asks the user to enter the number of players. The program will then initialize a two dimensional array
In Javascript
Write a test program that asks the user to enter the number of players. The program will then initialize a two dimensional array with user input that stores integer values for Uniform number, At-bats, Hits, and Batting Average.
sample table:
Unif. # | At-bats | Hits | Average |
23 | 10 | 2 | |
7 | 10 | 3 | |
8 | 10 | 1 | |
32 | 9 | 6 | |
1 | 10 | 2 | |
9 | 10 | 3 | |
25 | 10 | 1 | |
24 | 10 | 1 | |
13 | 3 | 2 | |
calculate each player's batting average (hits/at-bats) and insert it into the two-dimensional array, the total team hits, team at-bats, and the team batting average. Denote the batting average leader(s) with an asterisk (*). All batting averages should be on a basis of 1000 (e.g. 667)
Sample runs:
Enter the total number of players:
9
Enter 9 rows and 3 columns:
Unif # At-bats Hits:
----- ------- -----
23 10 2
7 10 3
8 10 1
32 9 6
1 10 2
9 10 3
25 10 1
24 10 1
13 3 2
Unif # At-bats Hits Average
----- ------- ----- -------
23 10 2 200
7 10 3 300
8 10 1 100
32 9 6 667*
1 10 2 200
9 10 3 300
25 10 1 100
24 10 1 100
13 3 2 667*
Total: 82 21 256
* Batting average leader
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started