Question: Using Python: Write a Phyton program to perform the following actions: DO NOT use arrays for the problems . a. Ask the user for a

Using Python:

Write a Phyton program to perform the following actions: DO NOT use arrays for the problems.

a. Ask the user for a persons name and salary (salary can be a whole number or a decimal number).

b. Dont allow the user to enter a negative number for salary.

c. Use the try/except construct to display an error message, if the value for salary entered by the user has any characters in it. For example, 100.8 is a valid entry, but a100 is invalid. Make sure to ask the user for a valid input.

d. Open an output file named mydata.txt, write the name and salary to the file and close the file. You should now have a file named mydata.txt in your system.

e. Ask the user to enter the name of any file, the users name and email address. Write the data to the file. In addition, use a loop to write the numbers 100 down to 0 with steps of -10 to the file. Close the file. You should have a brand new file in your system.

f. Open the file mydata.txt, read the name and the salary value from the file, display the name and the salary on the screen, and then close the file. Recall that you wrote to this file in part d, above.

g. Define a function that accepts the name of a file. Inside the function, ask the user for the number of employees for processing employee data. So, if the user wants to process 5 employees, you allow data entry for 5 employees. Then, ask for a set of values for hours worked and pay rate and calculate pay for each employee. Assume double pay (2 times pay rate) for hours worked more than 40 hours. Calculate the total pay and the average pay. Write the total pay and average pay to a file whose name is entered by the user (make sure to ask for the file name). Ask for the file name in your main function and pass it to the function to perform its operation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!