Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

9.8LAB: Input-Output Exceptions: Getting a Valid File In this exercise you will continue with exception processing for file input-output. You should extend the program developed

9.8LAB: Input-Output Exceptions: Getting a Valid File

In this exercise you will continue with exception processing for file input-output. You should extend the program developed in lab 9.7 that includes exception handling for non-existent files. To do this, you will need a loop that continues to prompt the user for file names until a valid file name (when opening it) occurs. In this case, your try-except will be inside the loop.

(1) Make sure that your program works correctly with "data.txt". (2pts)

(2) Test your program with the loop and a try-except to handle an incorrect name of a file name and continue to prompt the user until a valid file is entered. (8 pts)

For example, if you enter the name of a file "data", your program should output:

Enter name of file: File data not found. Enter new file name: File to be processed is: data.txt Average weight = 164.88 Average height = 69.38 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions