Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your task is to write an interactive Perl program. The program will display a welcome message and then repeatedly display a prompt to its user,

Your task is to write an interactive Perl program. The program will display a welcome message and then repeatedly display a prompt to its user, asking the user to either enter the letter q or Q to quit the program, or to enter c to continue. If the user enters a q or Q instead of a c , the program should terminate. Error checking: If the user enters any other character when it is waiting for the 'q', Q or the 'c', it should ignore it and display the prompt again. It should keep doing this until the user enters a valid character ('q', Q or 'c'.) If the user enters c, the program should run the following function and then continue come back and prompt again to enter a 'q', Q or the 'c'. Everytime I press c it should run the function. This loop should continue until I enter q or Q. Function: Open and read the file Patient_Info.txt. The file has four columns: Name Gender Dob Disease Your task is to store this information into an appropriate hash structure, where Name will be the key and the rest will be the list of values associated with that key. Your program will allow the user to change patient information and to output patient information to another file. Part 1 First you will prompt: Would you like to change the information (n/y)? Error Check to make sure that the user enters either a y or n. Otherwise ask the question again. If the user presses n (for no) you move on to part 2. If the user presses y , you then ask: Give Patients Name: The user should enter a name. Error Check to make sure the Patients name is present. If not, then you must output an error message and move on to part two. If it is, then you ask: Enter 1 to change the gender of the patient Enter 2 to change the Dob of the patient Enter 3 to change the disease the patient has Error Check to make sure the user enters 1,2 or 3 and keep re asking the question if the user enters anything else. Once the user has selected what he/she wants to change, simply allow the user to make the change for the patient and save the change. If the user enters 1: Please enter (M/F): Error Check make sure the user enters M or F or ask again. If the user enters 2: Please enter (xx/xx/xx): Error Check no error checks for this one. If the user enters 2: Please enter: Error Check make sure that the user enters a string, not number. Part 2 Now, prompt the user and ask if he/she would like to write to a file: Would you like to print patient information to a file (n/y)? Error Check to make sure that the user enters either a y or n. Otherwise ask the question again. If the user presses n (for no) you move on. If the user presses y , you then ask: Give Patients Name: The user should enter a name. Error Check to make sure the Patients name is present. If not, then you must output an error message to the terminal and move on. If it is, then print that patients information saved inside your data structure to a file called Info_accessed.txt in this EXACT format (with the colons): Name: Gender: Dob: Disease:

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

Students also viewed these Databases questions

Question

LO1 Identify why performance management is necessary.

Answered: 1 week ago