Write a function "main" that prompts the user to enter a filename and counts the number of keywords in the file. (use th

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a function "main" that prompts the user to enter a filename and counts the number of keywords in the file. (use th

Post by answerhappygod »

Write A Function Main That Prompts The User To Enter A Filename And Counts The Number Of Keywords In The File Use Th 1
Write A Function Main That Prompts The User To Enter A Filename And Counts The Number Of Keywords In The File Use Th 1 (42.98 KiB) Viewed 177 times
Write a function "main" that prompts the user to enter a filename and counts the number of keywords in the file. (use the exact same messages in the example). Keep in mind that your program should catch all possible errors and continue to request the filename from the user. I have uploaded some files so that you can use them. Filenames: test.txt, test2.txt, test3.txt, test6.txt In case of an error use the message "Error, No such file or directory" Here is a sample run: <Output> Enter the filename: test.txt The number of keywords in the file is 7 <End Output> The message you should use as follows. "Enter the filename: " "Error, No such file or directory" "The number of keywords in the file is" For example: Test Input main() test.txt main() testssss.txt Result Enter the filename: test.txt The number of keywords in the file is 7 Enter the filename: testssss.txt tests.txt Error, No such file or directory test6.txt Enter the filename: tests.txt Error, No such file or directory Enter the filename: test6.txt The number of keywords in the file is 601
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply