5.13) A baseball player's batting average is calculated as the number of hits divided by the official number of at-bats. In calculating official at- bats, walks, sacrifices, and occasions when hit by the pitch are not counted. Write a program that takes an input file containing player numbers and batting records. Trips to the plate are coded in the batting record as follows: H-hit, 0-out, W-walk, S-sacrifice, and P-hit by pitch. The program should output for each player the input data followed by the batting average. Data file would be similar to example below. Each new record is in new line and each line contains id of the player followed by his batting record: 13 ООHPS 2 онононон 31 WHOPWHOP SAMPLE RUN #4: ./Baseball Interactive Session Hide Invisibles Highlight: None Show Highlighted Only O Enter data-file-name:dat- Player 12's record: HO0OWSHHOOHPWMHOPOH Player 12's- batting average: -0.462- Player-4's.record: -OSOHHHWOHOHO000OH Player -4's-batting-average: -0.400- Player-7'srecord: WPOHOOHWOHHOWO00HOP- Player-7's-batting-average: -0.357e

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

IN C LANGUAGE

please take your time and put a readable, copyable code

show the output

5.13) A baseball player's batting average is calculated as the number of hits divided by the official number of at-bats. In calculating official at-
bats, walks, sacrifices, and occasions when hit by the pitch are not counted. Write a program that takes an input file containing player numbers
and batting records. Trips to the plate are coded in the batting record as follows: H-hit, 0-out, W-walk, S-sacrifice, and P-hit by pitch. The
program should output for each player the input data followed by the batting average.
Data file would be similar to example below. Each new record is in new line and each line contains id of the player followed by his batting record:
13 ООНPS
2 онононон
31 WHOPWHOP
SAMPLE RUN #4: ./Baseball
Interactive Session
Hide Invisibles
Highlight: None
Show Highlighted Only
Enter data file name:date
Player-12's-геcord:-HOOONSHHOOHPWMНОРОНне
Player 12's.batting average: 0.462-
Player.4's.record: OSOHHHWWOHOHOO000He
Player 4's.batting average: 0.400-
Player:7's.record: WPOHOOHWOHHOWOOOHOPe
Player.7's.batting average: 0.3574
Transcribed Image Text:5.13) A baseball player's batting average is calculated as the number of hits divided by the official number of at-bats. In calculating official at- bats, walks, sacrifices, and occasions when hit by the pitch are not counted. Write a program that takes an input file containing player numbers and batting records. Trips to the plate are coded in the batting record as follows: H-hit, 0-out, W-walk, S-sacrifice, and P-hit by pitch. The program should output for each player the input data followed by the batting average. Data file would be similar to example below. Each new record is in new line and each line contains id of the player followed by his batting record: 13 ООНPS 2 онононон 31 WHOPWHOP SAMPLE RUN #4: ./Baseball Interactive Session Hide Invisibles Highlight: None Show Highlighted Only Enter data file name:date Player-12's-геcord:-HOOONSHHOOHPWMНОРОНне Player 12's.batting average: 0.462- Player.4's.record: OSOHHHWWOHOHOO000He Player 4's.batting average: 0.400- Player:7's.record: WPOHOOHWOHHOWOOOHOPe Player.7's.batting average: 0.3574
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education