c++
/////////////////////////////////////////////////////////////////////////
need to be named Subsequences.h and pass test cpp file SubsequenceTester.cpp at the end of this question.
This assignment will help you solve a problem using recursion
Description
A subsequence is when all the letters of a word appear in the relative order of another word.
This assignment you will create a Subsequence class to do the following:
Hints
Think about the following questions to help you set up the recursion...
Submission
To get you thinking of data good test cases, only the example test cases have been provided for you in the SubsequenceTester.cpp. It is your responsibility to come up with several other test cases. Think of good ones
////////////////////////////////////////////////////
SubsequenceTester.cpp
#include <iostream>
#include "Subsequences.h"
using namespace std;
void checkCase(string, string, string, bool);
int main()
{
/**
Add several more test
cases to thoroughly test your data
checkCase takes the
following parameters (name, word, possible subsequence, true/false
it would be a subsequence)
**/
checkCase("Case 1: First Letter", "pin",
"programming", true);
checkCase("Case 2: Skipping Letters", "ace",
"abcde", true);
checkCase("Case 3: Out of order", "bad",
"abcde", false);
return 0;
}
void checkCase(string testCaseName, string sub, string sentence,
bool correctResponse){
Subsequences s(sentence);
if(s.isSubsequence(sub) ==
correctResponse){
cout << "Passed "
<< testCaseName << endl;
}
else{
cout << "Failed "
<< testCaseName << ": " << sub << " is "
<< (correctResponse? "": "not ") << "a subsequence of "
<< sentence << endl;
}
}
In: Computer Science
Hello I need a small fix in my program. I need to display the youngest student and the average age of all of the students. It is not working Thanks.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
struct Student {
string firstName;
char middleName;
string lastName;
char collegeCode;
int locCode;
int seqCode;
int age;
};
struct sort_by_age {
inline bool operator() (const Student& s1, const Student& s2)
{
return (s1.age < s2.age); // sort according to age of student
}
};
// main function to run program
int main() {
//CHANGE: vector students; TO vector students;
vector<Student> students; // create vector object to hold students data
ifstream Myfile; // create input file stream object
Myfile.open("a2data.txt"); // open file
// check if file is open
if (!Myfile.is_open()) {
// display error message if file could not be opened
cout << "Could not open the file!";
return 0; //terminate
}
//CHANGE: vector words; TO vector words;
vector<string> words; // create vector object to store words from input file
//read input from file line by line
string line;
while (!Myfile.eof()) {
getline(Myfile, line); // readline from input file stream
line.c_str(); // convert string in to char array
// file given in eample does not contain one record each line
// but it hase some patern for reading
// each word is seprated by space
//read the liine till space is encountered and get the word
int i = 0; // iterator to iterate over line
string word = "";
while (line[i] != '\0') {
// loop till end of line
if (line[i] != ' ') {
word = word + line[i]; // build word with char
i++;
}
else {
if(word!="")
words.push_back(word); // add word to vector
word = ""; //reset word to empty string
i++; //ignore white space
}
}//end of line
words.push_back(word); // add word to vector
}//end of file
//when done reading input from file close the file stream
Myfile.close();
int count = 0; // counts the words proceesed from vector object words
string fname = words.at(count); // variable to store first name of student
count++; //move to next element in the vector
//CHANGE: count < words.size() TO count < words.size() - 2
// at least two words are read in an iteration, so at least two should remain to be read - last name + student id
while (count < words.size() - 2) {
// loop till end of vector words
// create student object
Student s;
//assign first name to student
s.firstName = fname;
//next element in words is middle name
//assign first char to middle name
string mname = words.at(count);
s.middleName = mname[0];
count++;
//next element is last name of student
//assign next word to student
s.lastName = words.at(count);
//CHANGE: start
//If there was no middle name, this is the student id + first name of next student
if(words.at(count).size() >= 12) // college code + locCode + seq + age
{
if(words.at(count)[1] >= '0' && words.at(count)[1] <= '9') // if second character is a digit
{
// this is the student id field, and there is no middle name
count --; // move one step back for next iteration
s.middleName = ' '; //blank middle name
s.lastName = words.at(count);
}
}
//CHANGE: end
count++;
//next element is student id + first name of next student
//id contains college code at first latter
string id = words.at(count);
count++;
//assign college code to the student
s.collegeCode = id[0];
//next 2 char in id contain location
string loc = "";
loc = loc + id[1];
loc = loc + id[2];
// assign location to student
s.locCode = stoi(loc); // convert string to integer
//next 6 char in id contain seqcode
string seq = "";
for (int j = 3; j < 9; j++) {
seq = seq + id[j];
}
// assign seqcode to student
s.seqCode = stoi(seq); //convert string to int
//next 3 char in id contains age
string age = "";
age = age + id[9];
age = age + id[10];
age = age + id[11];
//assign age to student
s.age = stoi(age); // convert string to int
//remainig latters in id contains next student's first name
// delete id of previous student to get name of next student
fname = id.erase(0, 12); // delete first 12 char from id and assign remaining to fname
// add student to student
students.push_back(s);
}
// clear the vector as done working with words
words.clear();
//sort vector according to age of students
sort(students.begin(), students.end(), sort_by_age());
// formating output
cout << setw(15) << left << "Last Name";
cout << setw(15) << left << "Midlle Name";
cout << setw(15) << left << "First Name";
cout << setw(15) << left << "College Code";
cout << setw(12) << left << "Location";
cout << setw(12) << left << "Sequence";
cout << setw(12) << left << "Age" << endl;
cout << "=======================================================================================" << endl;
// print all students
for (int i = 0; i < students.size(); i++) {
cout << setw(15) << left << students.at(i).lastName;
cout << setw(15) << left << students.at(i).middleName;
cout << setw(20) << left << students.at(i).firstName;
cout << setw(13) << left << students.at(i).collegeCode;
cout << setw(10) << left << students.at(i).locCode;
cout << setw(12) << left << students.at(i).seqCode;
cout << students.at(i).age << endl;
}
//print average age
cout << endl;
int avg_age = ageCalc(arry, youngest);
cout<<"Average age is: "<<avg_age<<endl;
cout<<"Youngest student is "<<youngest->firstName<<" "<<youngest->MiddleN<<" "<<youngest->LastN<<endl;
for(int i=0; i<index; i++){
delete arry[i];
}
return 0;
}
int ageCalc(Student *studs[], Student *&youngest){
youngest = studs[0];
int i = 0;
int avg_age = 0;
while(studs[i]!=NULL){
avg_age += studs[i]->age;
if(youngest->age>studs[i]->age)
youngest = studs[i];
i++;
}
return avg_age/i;
}
File needed:
https://drive.google.com/file/d/15_CxuGnFdnyIj6zhSC11oSgKEYrosHck/view?usp=sharing
In: Computer Science
explain why liquidity risk and credit in the financial crisis
In: Operations Management
1. Page 1 of report:
Prepare a title page for this Annual Report (in Word). The name of this report is:
Annual Report of the Cancer Program, 2018
Hospital Name (make one up)
Your City, State
Prepared by: student name
2. Page 2 of report:
Include an Introduction, explaining the purpose of the report.
Prepare an alphabetical listing of the Cancer Committee members. They include:
A. F. Catherson, M.D.
C. P. Tomeko, M.D.
A. B. Nichols, M.D.
L. E. Smith, D.O.
C. D. Seagram, D.O.
B.W. Ye, M.D.
Include also the Cancer Program Components in alphabetical order:
Home Health
Hospice
Multidisciplinary Cancer Committee
Cancer Registry
Radiation Oncology
Chemotherapy
Tumor Conference
Surgery
Diagnostic Radiology
Respite Care
Oncology Nursing Unit
Social Service
Chaplain Services
Nutrition Services
Laboratory and Histology
Pharmacy
Patient Support Group
American Cancer Society Support Group
3. Page 3 of report and Subsequent pages: develop graphs and charts based upon the data provided on pages 4 & 5 of this instructions document.
Page 3: Prepare a pie graph of total cases by site in 2017
Page 4: Prepare a column graph indicating the age distribution
Page 5: Prepare a pie chart indicating the stage at diagnosis.
Pages 6 and 7: Prepare a bar graph of males by site and females by site
Page 8: Prepare a line graph indicating the incidence of lung cancer cases over a five year period.
Page 9: Prepare a graph (choose an appropriate one) for age at diagnosis for lung cancer.
Page 10: Prepare a graph (choose an appropriate one) of how the diagnosis of lung cancer was made.
Page 11: Prepare a graph (choose an appropriate one) of the histology of lung cancer.
Page 12: Prepare a bar graph of lung cancer treatment
In: Statistics and Probability
In: Economics
A word that reads the same from left to right and right to left is a palindrome. For example, "I", "noon" and "racecar" are palindromes. In the following, we consider palindromic integers. Note that the first digit of an integer cannot be 0.
How many positive palindromic integers are 5-digit long and contain 7 or 8?
In: Statistics and Probability
a) How many arrangements are there of the letters of the word FEEBLENESS?
(b) What is the probability that if the letters are arranged at random four Eās will be together?
(c) In a random arrangement, what is the probability that exactly three Eā s will be together?
In: Statistics and Probability
a) How many arrangements are there of the letters of the word FEEBLENESS?
(b) What is the probability that if the letters are arranged at random four Eās will be together?
(c) In a random arrangement, what is the probability that exactly three Eā s will be together?
In: Statistics and Probability
2. For each of the following sentences, fill in the blanks with the best word or phrase in the list below. Not all words or phrases will be used; use each word or phrase only once During transcription in __________________ cells, transcriptional regulators that bind to DNA thousands of nucleotides away from a geneās promoter can affect a geneās transcription. The __________________ is a complex of proteins that links distantly bound transcription regulators with the proteins bound closer to the transcriptional start site. Transcriptional activators can interact with histone __________________s, which alter chromatin by modifying lysines in the tail of histone proteins to allow greater accessibility to the underlying DNA. Transcription regulators can also recruit _______________________ to the promoter region of a gene, causing the DNA packaged in chromatin more accessible to proteins required for ___________________.
Options:
viral acetyltransferase centrosome helicase chromatin-remodeling complexes procaryotic peroxidase eucaryotic Mediator deoxidase heterochromatin telomere enhancer leucine zipper transcription initiation translation initiation transcription elongation translation termination
In: Biology
Which of the following is an example of ways in which the word āassuranceā is sometimes used?
A. Actions taken to provide a basis for justified confidence ā these actions may constitute how something is done, or the evaluations of something or how it is/was done;
B. Arguments and evidence that reduce uncertainty or provide grounds to justify confidence
C. Degree an individual or organization has of justified confidence in something such as the justifiable confidence that a system exhibits all of its required properties and satisfies all of its other requirements
D. All of the above
In software design, separation can eliminate or reduce the possibilities of certain kinds of violations via implementing the following except___________
A. most common mechanisms
B. Separation of duties
C. Separation of privilege
D. Constrained dependency
After failure, software system should have a well-defined status. Which of the following is a valid status?
A. Rollback
B. Fail forward
C. Compensate
D. all of the above
The term āinformation assuranceā (sometimes referred to as IA) is often used as
A. A catch-all term for all that is done to assure security of information
B. The levels of uncertainty or justifiable confidence one has in that security
C. both a & b
D. neither a nor b
Which of the following is a kind of activities related to tolerance of errors or violation of software system correctness?
A. forecasting violations
B. notification and warning
C. repair of fault or vulnerability
D. All of the above
Common content filtering mechanisms include all but one of the followings. Which one?
A. Recovering to a safe sate
B. Security wrappers
C. Application firewalls
D. eXtensible Markup Language (XML) gateways
The anti-tamper mechanisms most frequently used for protecting software are all but one of the following. Which one?
A. Virtual machines
B. Simulation techniques
C. Hardened operating systems
D. Trusted hardware modules
Deception techniques at the system level can be used to divert potential attackers away from targeting the system and towards targeting a purpose-built decoy. Which of the following is a deception technique?
A. Honeypot
B. Intrusion detection system
C. Firewall
D. Virtual Private Network (VPN)
Which of the followings is not a software testing technique
A. Attack oriented tested
B. User oriented testing
C. Brute force and random testing
D. Fault and vulnerability-oriented testing
Network scanners are examples of ___________
A. Dynamic analysis tools
B. Static analysis tools
C. Compilers
D. None of the above
_________is an example of lightweight secure software process
A. Oracle security process
B. Microsoft secure development life cycle
C. CMMI process
D. OSI Security standard
Which of the following statements is correct?
A. Risk assessment is the process of planning, managing risk, and mitigating risk.
B. Risk management is the process of planning, assessing risk, and mitigating risk,
C. Risk management applies to software development but risk assessment apply to overall organization.
D. None of the above
In: Computer Science