A company stores payment information for their employee working on a project and paid on project basis, in a text file whose name is entered through keyboard (see a sample input fil- Delow). The first line of the file indicates the number of employees and each subsequent lin. corresponds to information related to an employee payment (employee name, number of hour vorked and his/her hourly wage). Write a python program that reads such a file and display he employees' names, their hours worked, and their salaries. Finally, it displays the tota payıment. Your program should consider the following CIToncous cases: The file does not open/exist The format of the data in the file is incorrect (e.g. hours =“1-" or salary = "unkown" in which case a RuntimeError exception should be raised and the processing shoul. %3D continue

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter5: Looping
Section: Chapter Questions
Problem 13PE
icon
Related questions
Question
A company stores payment information for their employee working on a project and paid on a
project basis, in a text file whose name is entered through keyboard (see a sample input file
below). The first line of the file indicates the number of employees and each subsequent line
corresponds to information related to an employce payment (employee name, number of hours
worked and his/her hourly wage). Write a python program that reads such a file and displays
the employees' names, their hours worked, and their salaries. Finally, it displays the total
Your
program should consider the following erroncous cases:
рaуmеnt.
• The file does not open/exist
The format of the data in the file is incorrect (e.g. hours = "1-" or salary = "unkown")
in which case a RuntimeError exception should be raised and the processing should
continue
Enter input filename: employees.txt
Employee
Hours
Salary
Badria Al-Harthi: 11
Youcef Al-Busaidi: 19 720
Salim Al-Hajri:
Majid Al-Sinani:
Amer Al-Shidani: 10 unkown.
520
Badria Al-Harthi
Youcef Al-Busaidi
File contents invalid.
Majid Al-Sinani
File contents invalid.
11
19
5720.0
13680.0
1-
890
1060
9540.0
Total payenent
28940.0
Sample input file
Sample output
Transcribed Image Text:A company stores payment information for their employee working on a project and paid on a project basis, in a text file whose name is entered through keyboard (see a sample input file below). The first line of the file indicates the number of employees and each subsequent line corresponds to information related to an employce payment (employee name, number of hours worked and his/her hourly wage). Write a python program that reads such a file and displays the employees' names, their hours worked, and their salaries. Finally, it displays the total Your program should consider the following erroncous cases: рaуmеnt. • The file does not open/exist The format of the data in the file is incorrect (e.g. hours = "1-" or salary = "unkown") in which case a RuntimeError exception should be raised and the processing should continue Enter input filename: employees.txt Employee Hours Salary Badria Al-Harthi: 11 Youcef Al-Busaidi: 19 720 Salim Al-Hajri: Majid Al-Sinani: Amer Al-Shidani: 10 unkown. 520 Badria Al-Harthi Youcef Al-Busaidi File contents invalid. Majid Al-Sinani File contents invalid. 11 19 5720.0 13680.0 1- 890 1060 9540.0 Total payenent 28940.0 Sample input file Sample output
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Constants and Variables
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage