Question

In: Computer Science

C Programming question part 3: The following program is an emergency hospital patient admitting process. This...

C Programming question part 3: The following program is an emergency hospital patient admitting process. This program needs a few changes to be sufficient for the hospital. The social security number needs to be encrypted. The hospital would like to do this by having you create a function will accept as input a properly formatted social security number. Then increment each digit by one. If the digit is "9" then make it a "0". Return a properly formatted social security number.

Then create a function that will do the opposite. This function will take an encoded social security number and convert it back into an unencrypted social security number. The de-encoded number is what this function will return.

For each patient, print their full name, their original social security number, their encoded social security number, and then their de-encoded social security number.

a.For each patient, print their full name, their original social security number, their encoded social security number, and then their de-encoded social security number.

#include
#include
#include
#include

using namespace std;

int main() {

char lname[][10]= {"Johnson","Williams","Ling","Albin","Anderson","Baca","Birner","Dominguez","Aimino","Armstrong","Beard","Calderon","Carter","Chaname"," Chaney"}; char fname[][10] = {"Fred","Betty","Hector","Ross","Jason","Elisa","Dalton","Javier","Ann","Addison","Cindy","Yamil","Thomas","Bryan","Kris"}; char middle[] = {'N','L','X','L','O','L','M','B','S','T','J','C','P','D','Z'}; char addr[][50] = {"2763 Filibuster Drive","701 Collage Avenue","1500 Raceway Lane","207 Daisy Avenue","1527 Lewis Road","25 Hunters Lane","851 Applebe Court","1410 Waterford Blvd","2379 Runners Way","46 Hawthorne Drive","1814 Constitution Ct","345 Cigar Row","896 Pine Avenue","24 Blue Belt Drive","2589 College Court"}; cities[]={"Lakeland","Orlando","Tampa","Lakeland","Tampa","Lakeland","Orlando","Orlando","Lakeland","Lakeland","Orlando","Tampa","Tampa" ,"Lakeland","Orlando"};int zip[] = {37643,31234,32785,32643,32785,32643,31234,31234,32643,32643,31234,32785,32785,32643,31234}; char gender[] = {'M','F','M','M','M','F','M','M','F','M','F','M','M','M','F'}; char dob[][11] = {"05/27/1935","11/27/1971","10/17/2003","12/08/1990","11/25/1991","10/30/1992","09/22/1993","08/04/1994","07/11/1995","06/18/1996","05/2 8/1997","04/07/1998","03/12/1999","02/23/2000","01/15/2001"}; char social[][12] = {"164-55-0726","948-44-1038","193-74-0274","458-57-2867","093-00-1093","159-56-9731","695-21-2340","753-66- 6482","852-73-4196","648-81-1456","879-61-1829","123-87-0000","000-65-3197","741-85-9632","963-25-7418"};
vector fullName;
vector zombies_zip;
std::map dups;


char buffer[16];
char buffer2[16];


// for (int i = 0; i < 15; ++i)
// {
// //char buffer[16]; // large enough
// //char buffer2[16];
// strcpy(buffer, lName[i]);
// strcat(buffer, fName[i]);
// cout << lName[i] << " " << fName[i] << " " << buffer << endl;
// cout << buffer << middleInitial[i] << endl;
//
// }

for(int i =0; i < 15; i++){
if(zombie[i] == 'Y'){
zombies_zip.push_back(zip[i]);
}
}


sort(zombies_zip.begin(), zombies_zip.end());

// for (int i=0; i // cout << zombies_zip[i] << "\n";

for(int i : zombies_zip)
++dups[i];

for(auto& dup : dups)
cout << dup.first << " has " << dup.second << " zombies\n";


//cout<<"Last Name: "<< last_name << ", "<< "First Name: " << first_name << " ," << "Middle name: " << middle_name << " ," << "Street address: "<< street_address << " ," << "City: " << city << " ," << "State: " << state <<" ," << "Zip: " << zip << endl;

//printf("Zombie: %c, ""Gender: %c, Date of Birth: %d-%d-%d, Insurance: %c, Social Security Number %s", gender, date_of_birth[0], date_of_birth[1], date_of_birth[2], insurance, social_security_number);

//cout<<"Zombie?: "<< zombie << ", "<< "Gender: " << gender << " ," << "Date of Birth: " << date_of_birth[0] << "/" << "/" << date_of_birth[1] << date_of_birth[2] << " ," << "Insurance?: "<< insurance << " ," << "Social Security: " << social_security_number<< endl;

cout << "Number of patients: " << sizeof(lName)/sizeof(lName[0]) << endl;
cout<<"Number of zombies: " << num_of_zombies << endl;

}

New format for patient record: Last Name, First Name, Middle Initial, Address, City, State, Zip, Sex, Date of Birth, SS #, Zombie?

Solutions

Expert Solution

#include<stdio.h>
#include<stdlib.h>
int* cipher(long int originalSecurity);
int main(){
int i=0,num[100];
char lname[][10]= {"Johnson","Williams","Ling","Albin","Anderson","Baca","Birner","Dominguez","Aimino","Armstrong","Beard","Calderon","Carter","Chaname"," Chaney"}; char fname[][10] = {"Fred","Betty","Hector","Ross","Jason","Elisa",
"Dalton","Javier","Ann",
"Addison","Cindy","Yamil",
"Thomas","Bryan","Kris"};
long int originalSecurity;
printf("enter your original security number");
scanf("%ld",&originalSecurity);
int encrypted[20]=cipher(originalSecurity);
while(i<17){
printf("%s",&lname[i][10]);
printf("originalSecurity:-%ld",originalSecurity);
printf("encrypted originalSecurity is ");
for(i=length(encrypted);i<=0;i++){
print("%ld",encrypted[i]);
}
printf("original Security is %ld",originalSecurity);
}
return 0;
}
int* cipher(long int originalSecurity){
while(originalSecurity!=0){
int num[i]=originalSecurity%10+1;
if(num[i]==9){
num[i]==0;
}
long int originalSecurity=/10;
}
return num;
}


Related Solutions

C Programming question part 4: The following program is an emergency hospital patient admitting process. This...
C Programming question part 4: The following program is an emergency hospital patient admitting process. This program needs a few changes to be sufficient for the hospital. Some patients who have been arriving at the Hospital have been providing social security numbers that are not valid. Create a function to scan all of the patient's social security numbers and detect if any of them are invalid. A Social Security Number (SSN) consists of nine digits, commonly written as three fields...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with shortness of breath and recent weight loss. After receiving a report from the ED nurse, you ready the patient’s room according to unit specifications and collect the necessary equipment and forms. When the patient arrives, she is using oxygen via a nasal cannula and seems to be comfortable. As you begin your admission activities and paperwork, you note that her shortness of breath slightly...
You are a nurse admitting a patient to the hospital from the emergency department with shortness...
You are a nurse admitting a patient to the hospital from the emergency department with shortness of breath and recent weight loss. After receiving a report from the ED nurse you ready the patient's room according unit specifications and collect the necessary equipment and forms. When the patient arrives,she is using oxygen via a nasal cannula and seems to be comfortable .As you begin your admission activities and paperwork, you note that her shortness of breath slightly increases as she...
You are a nurse admitting a patient to the hospital from the emergency department with severe...
You are a nurse admitting a patient to the hospital from the emergency department with severe abdominal pain of unknown origin. He is a 42-year-old construction worker who has a history of asthma and sleep apnea. He is accompanied to the hospital by his wife, and they have four teenage children who live at home. His wife is an elementary school teacher. The physician has written orders, which includes several tests. 1.What data in the scenario is pertinent? (This is...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with shortness of breath and recent weight loss. After receiving a report from the ED nurse, you ready the patient’s room according to unit specifications and collect the necessary equipment and forms. When the patient arrives, she is using oxygen via a nasal cannula and seems to be comfortable. As you begin your admission activities and paperwork, you note that her shortness of breath slightly...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with shortness of breath and recent weight loss. After receiving a report from the ED nurse, you ready the patient’s room according to unit specifications and collect the necessary equipment and forms. When the patient arrives, she is using oxygen via a nasal cannula and seems to be comfortable. As you begin your admission activities and paperwork, you note that her shortness of breath slightly...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with shortness of breath and recent weight loss. After receiving a report from the ED nurse, you ready the patient’s room according to unit specifications and collect the necessary equipment and forms. When the patient arrives, she is using oxygen via a nasal cannula and seems to be comfortable. As you begin your admission activities and paperwork, you note that her shortness of breath slightly...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with shortness of breath and recent weight loss. After receiving a report from the ED nurse, you ready the patient’s room according to unit specifications and collect the necessary equipment and forms. When the patient arrives, she is using oxygen via a nasal cannula and seems to be comfortable. As you begin your admission activities and paperwork, you note that her shortness of breath slightly...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with...
You are a nurse admitting a patient to the hospital from the emergency department (ED) with shortness of breath and recent weight loss. After receiving a report from the ED nurse, you ready the patient’s room according to unit specifications and collect the necessary equipment and forms. When the patient arrives, she is using oxygen via a nasal cannula and seems to be comfortable. As you begin your admission activities and paperwork, you note that her shortness of breath slightly...
You are a nurse admitting a patient to the hospital from the emergency department with shortness...
You are a nurse admitting a patient to the hospital from the emergency department with shortness of breath and recent weight loss. After receiving a report from the emergency department nurse,you ready the patients room according to unit specifications and collect the necessary equipment and forms. When the patient arrives she is using oxygen via a nasal cannula and seems to be comfortable. As you begin your admission activities and paperwork,you note that her shortness of breath increases slightly as...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT