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?
In: Computer Science
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 separated by hyphens: AAA-GG-SSSS. The first three-digit field is called the "area number". The central, two-digit field is called the "group number". The final, four-digit field is called the "serial number". Any SSN conforming to one of the following criteria is an invalid number: Any field all zeroes (no field of zeroes is ever assigned)., First three digits above 740
a. If you detect an invalid social security number, print the patient's name, their social security number, and then either "area number", "group number", or "serial number" to indicate where the problem with the social security number was detected.
#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?
In: Computer Science
hello! this is my C++ ASSIGNMENT. Pls my professor is very delicate when it comes to grading. I am beginner, if you can please provide me with comments I will appreciate it!!
The Weather Service Bureau department has data representing monthly rainfall for a year and we would like to create a table categorizing each month as rainy (rainfall 20% higher than average) dry (rainfall 25% lower than average) or average. The data file for monthly rain fall is called rainfall.txt.
rainfall.txt
95 100 120 130 135 145 155 185 190 160 130 120
Store the data file in the same folder of your lab6.cpp.
Output
The year's average monthly rainfall was 139 mm.
September has the highest rainfall (190 mm).
January has the lowes rainfall (95 mm)
Month Rainfall(mm)
Classification
-------
--------------- --------------
1
95
Dry
2
100
Dry
3
120
Average
4
130
Average
5
135
Average
6
145
Average
7
155
Average
8
185
Rainy
9
190
Rainy
10
160
Average
11
130
Average
12
120
Average
Program Requirements:
Implement the following functions in the program:
void inputRainfall(int rainFal l[], int size)
The function reads the monthly rainfall from the file rainFall.txt
and stores them in the array rainFall
int calculateAverageRainFall(int rainFall [], int size)
Return the average monthly rainfall
void classifyAndDisplayRainfall(int rainFall[], int months);
Classify and display each month as average, rainy, or dry.
In: Computer Science
Create individual python code cells for each of the three problems below. In each code cell, use any additional variables and comments as needed to program a solution to the corresponding problem. When done, download the ipynb file and submit it to the appropriate dropbox in the course's canvas page
. 1.
a. Cell Number 1 * Recreate the same list of dictionaries you used during assignment 2.09. (Scroll down to see assignment 2.09 instructions) * Create another variable and define it as an empty list. It will store middle names, so name the variable appropriately. * Loop through the list of dictionaries using a `for` loop, and add each middle name to the list created to hold middle names in the previous bullet point.
b. Cell Number 2 * Create a variable and assign it the length of the middle names list created in the previous cell. Use the appropriate instruction to calculate the length instead of just typing the correct number, which is known as hard-coding. (Hint: You don't have to redefine the list in the new cell as long as you ran the previous cell recently) * Use a `while` loop to count up to the length of the middle names list, and print out the index and value of each item in the list using a format string. (Hint: start your counter at `0` and stop iterating before you reach the length by using a `<` operator)
c. Cell Number 3 * Loop through the list of dictionaries defined in the first cell using another `for` loop. (Hint: Again, you do not need to redefine the list of dictionaries from the previous cell as long as you executed it recently) * Nested inside of that loop, loop through the keys in the current dictionary using another `for` loop and the `enumerate()` instruction. * Nested inside of the nested loop, print out the key and value using a format string. (Hint: You'll need to use the key to get the value out of the dictionary) * Also inside of the nested loop, once the index is greater than or equal to 2, break out of the loop.
2.09 assingment instructions for question 1
**Requirements:** * Create a list containing separate dictionaries for at least 3 people (family members, actors, invisible friends, etc.) and assign the list to a variable. Instead of using your actual family members' names, I want you think of different names starting with the same letter as your family member so that I can't be accused of identity theft. * Each person dictionary should have at least 4 key/value pairs: * first name * middle name. * age (rounded to the nearest decade) * your favorite thing about them * Be sure to use the same keys for each person (eg. "first_name" for everyone's first names). * Print out the entire list.
In: Computer Science
The Programming Language is C++
Objective:
The purpose of this project is to expose you to:
One-dimensional parallel arrays, input/output, Manipulating summation, maintenance of array elements. In addition, defining an array type and passing arrays and array elements to functions.
Problem Specification:
Using the structured chart below, write a program to keep records and print statistical analysis for a class of students. There are three quizzes for each student during the term. Each student is identified by a four-digit student ID number. The number of students in the class is unknown, therefore we need to detect end of file to stop. The file pr2data.txt is included and contains the data.
The program calculates the statistics for each student and for each quiz as shown in the sample output. The output goes to a file and is in the same order as the input and should be similar to the following: any other improvements to the output are welcomed.
CIS Department – Fall 2018
CIS 161 Class Statistics
Student Quiz 1 Quiz 2 Quiz 3 Average
1234 78 83 87 82.67
2134 67 77 84 76.00
3124 77 89 93 86.33
High score 78 89 93
Low score 67 77 84
Quiz Average 73.4 83.0 88.2
pr2data
1234 52 70 75
2134 90 76 90
3124 90 95 98
4532 21 17 81
5678 20 22 45
6134 34 45 55
7874 60 99 56
8026 70 10 66
9893 34 09 77
2233 78 20 78
1947 45 40 88
3456 78 55 78
2877 55 50 95
3189 70 98 78
2132 77 97 80
4602 89 50 91
3445 78 60 78
5405 35 33 15
4556 78 20 18
6999 88 98 89
9898 48 78 68
2323 78 20 78
Requirements:
Grading Criteria:
5 points There are sufficient comments in the programs.
5 points use the typedef to define all arrays.
5 points a flowchart of the function main () is included and is correct (only main()).
5 points use a counter to count the number of elements read.
5 points generate an error if file does not exist, or if not open.
10 points loop is included and reads the data until it encounters the end of file.
5 points proper passing by value/by reference for all functions.
5 points the function findstavg () finds the float average for each student.
5 points the function findhigh () is clear correct and returns the highest quiz.
5 points the function findlow () is clear correct and returns the lowest quiz.
10 points the function findqzavg () is clear correct and returns a quiz average.
5 points every function has specifications.
5 points headings, column titles are printed, formatted and looks nice.
5 points data/calculated results are printed with proper spacing and proper formatting.
15 points the program runs correctly and produces the intended results.
5 points output are printed to a file.
In: Computer Science
Design an Essay class that is derived from the GradedActivity
class:
class GradedActivity{
private:
double score;
public:
GradedActivity()
{score = 0.0;}
GradedActivity(double s)
{score = s;}
void setScore(double s)
{score = s;}
double getScore() const
{return score;}
char getLetterGrade() const;
};
char GradedActivity::getLetterGrade() const{
char letterGrade;
if (score > 89) {
letterGrade = 'A';
} else if (score > 79) {
letterGrade = 'B';
} else if (score > 69) {
letterGrade = 'C';
} else if (score > 59) {
letterGrade = 'D';
} else {
letterGrade = 'F';
}
return letterGrade;
}
The Essay class should determine the grade a student receives on an
essay. The student's essay score can be up to 100, and is made up
of four parts:
The Essay class should have a double member variable for each of
these sections, as well as a mutator that sets the values of these
variables. It should add all of these values to get the student's
total score on an Essay.
Demonstrate your class in a program that prompts the user to input
points received for grammar, spelling, length, and content, and
then prints the numeric and letter grade received by the
student.
In: Computer Science
Write a Python program that prompts the user to enter a list of words and stores in a list only those words whose first letter occurs again within the word (for example, 'Baboon'). The program should display the resulting list..................please explain step by step
In: Computer Science
Create a Software Application for XYZ Bank that allows its members to access their bank account information through an “ATM like” interface. The Menu Options should include: checking the account balance, debiting the account and crediting the account, along with an option to exit the program.
Create an Account Class to represent the customers’ bank accounts. Include a data member of type float to represent the account balance. Provide a constructor that receives an initial balance and uses it to initialize the data member.
Can someone please help me in Creating a console application in C++ that meet the requirements outlined above. With comments Lines
In: Computer Science
Create a program that implements a singly linked list of Students.
Each node must contain the following variables:
In main():
Student_ID |
Student_Name |
00235 |
Mohammad |
00662 |
Ahmed |
00999 |
Ali |
00171 |
Fahad |
Student_ID |
Student_Name |
00236 |
Salman |
00663 |
Suliman |
00998 |
Abdulrahman |
In: Computer Science
How would i write a MIPS program that converts 2 decimals to binary
In: Computer Science
What would be the result of each of the following programs?
1 |
public class
RecursionInJava1{ } Public static int guess(int num){ if (num == 1) return 0; else return (guess(num-2)-num); } } |
|
2 |
public class
RecursionInJava2{ } } } |
In: Computer Science
Write a C function gcd that returns the greatest common divisor of two integers. The greatest common divisor (GCD) of two integers is the largest integer that evenly divides each of the two numbers.
In: Computer Science
Q6.13) Unary minuses can be added in several ways to the arithmetic expression grammar of Figure 6.17 or Figure 6.18. Revise the BNF and EBNF for each of the cases that follow so that it satisfies the stated rule:
expr → expr + term | term
term → term * factor | factor
factor → ( expr ) | number
number → number digit | digit
digit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
[Figure 6.17. Revised grammar for simple integer arithmetic expressions]
expr → term { + term }
term → factor { * factor }
factor → ( expr ) | number
number → digit { digit }
digit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
[Figure 6.18 EBNF rules for simple integer arithmetic expressions]
(a) At most, one unary minus is allowed in each expression, and it must come at the beginning of an expression, so -2 + 3 is legal (and equals 1) and -2 + (-3) is legal, but -2 + -3 is not.
(b) At most, one unary minus is allowed before a number or left parenthesis, so -2 + -3 and -2 * -3 are legal, but --2 and -2 + --3 are not.
(c) Arbitrarily many unary minuses are allowed before numbers and left parentheses, so everything above is legal.
In: Computer Science
This is a request for Java High Scores Program with 2 files.
Rewrite the high scores assignment(code below) so that the names and scores are stored in an array of HighScore objects instead of parallel ArrayLists.
The new Program should have the same output as the original. Here is a sample run of the program:
Enter the name for score #1: Suzy
Enter the score for score #1: 600
Enter the name for score #2: Kim
Enter the score for score #2: 9900
Enter the name for score #3: Bob
Enter the score for score #3: 1012
Enter the name for score #4: Armando
Enter the score for score #4: 8000
Enter the name for score #5: Tim
Enter the score for score #5: 514
Top Scorers:
Kim: 9900
Armando: 8000
Bob: 1012
Suzy: 600
Tim: 514
Step 1: The HighScores class
Begin by creating the HighScore class. It should have the following design
Class HighScore
String name int score |
HighScore(String n, int s) void setName(String n) String getName() void setScore(int s) int getScore() |
Step 2: The HighScoresProgram
Create a separate file named HighScoresProgram.java. This file should contain a class that has only four following static methods.
public static void main(String args[])
public static void initialize(HighScores[] scores)
public static void sort(HighScores[] scores)
public static void display(HighScores[] scores)
The main method should allocate an array of five HighScore references, and then invoke the other three methods.
What to Submit?
Submit HighScores.java HighScoresProgram.java
Here is previous code to build from:
import java.util.*; public class HighScores{ public static void main(String[] args){ ArrayList<String> names = new ArrayList<>(); ArrayList<Integer> scores = new ArrayList<>(); initialize(names, scores); sort(names, scores); System.out.println("\n\nTop Scorers:"); display(names, scores); } // user input is done in a method named initialize public static void initialize(ArrayList<String> names, ArrayList<Integer> scores){ int i=1; Scanner input=new Scanner(System.in); String choice; do{ System.out.print("\nEnter the name for score #" + i + ": "); names.add(input.next()); System.out.print("Enter the score for score #" + i + ": "); scores.add(input.nextInt()); System.out.print("Do you want to add another score? (y/n): "); choice = input.next(); i++; } while(choice.equalsIgnoreCase("Y")); } // function that sorts both array lists, based on the values in the scores array list public static void sort(ArrayList<String> names, ArrayList<Integer> scores){ int count = scores.size(); int tempScore; String tempName; for (int i = 0; i < count - 1; i++){ for (int j = i + 1; j < count; j++){ if (scores.get(i) < scores.get(j)){ tempScore = scores.get(i); scores.set(i, scores.get(j)); scores.set(j, tempScore); tempName = names.get(i); names.set(i, names.get(j)); names.set(j, tempName); } } } } // method that displays the contents of the two arraylists public static void display(ArrayList<String> names, ArrayList<Integer> scores){ for (int i = 0; i < scores.size(); i++){ System.out.println(names.get(i) + " : " + scores.get(i)); } } }
In: Computer Science
Language: Java(Netbeans)
Implement a simple calculator.
In: Computer Science