esign a program that reads a file called sales.txt containing the following data: ane, 215.5, 445.5,910.0 ohn, 825.0,250.5,675.0 ill,0.0,999.15 ach line has a employee's name and their weekly sales totals all separated by commas. Some employees have taken vacation some weeks so no numbers are aptured for those weeks. Create a function that takes a list of floats and returns the average value for those numbers. After reading the information from the file se a for loop to calculate the sales average using your new average function for each employee and display the following output to the screen. ane, average sales: 523.67 ohn, average sales: 583.50 ill, average sales: 499.56

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 4PP
icon
Related questions
Question
Design a program that reads a file called sales.txt containing the following data:
Jane, 215.5,445.5,910.0
John, 825.0,250.5,675.0
Bill,0.0,999.15
Each line has a employee's name and their weekly sales totals all separated by commas. Some employees have taken vacation some weeks so no numbers are
captured for those weeks. Create a function that takes a list of floats and returns the average value for those numbers. After reading the information from the file,
use a for loop to calculate the sales average using your new average function for each employee and display the following output to the screen.
Jane, average sales: 523.67
John, average sales: 583.50
Bill, average sales: 499.56
Transcribed Image Text:Design a program that reads a file called sales.txt containing the following data: Jane, 215.5,445.5,910.0 John, 825.0,250.5,675.0 Bill,0.0,999.15 Each line has a employee's name and their weekly sales totals all separated by commas. Some employees have taken vacation some weeks so no numbers are captured for those weeks. Create a function that takes a list of floats and returns the average value for those numbers. After reading the information from the file, use a for loop to calculate the sales average using your new average function for each employee and display the following output to the screen. Jane, average sales: 523.67 John, average sales: 583.50 Bill, average sales: 499.56
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,