#include <iostream>
#include <string>
#include <iostream>
#include <vector>
using namespace std;
float findBestMatch(string sequence1 , string sequence2){
if(sequence1.size() ==0 || sequence2.size()==0)
return -1;
if(sequence1.size() < sequence2.size())
return 0;
float count = 0.0;
int j = 0, max = -1;
for(int i = 0;i<sequence1.size();++i ){
count = 0;
for(j = 0;j<sequence2.size();++j, ++i ){
if(sequence1.at(i) != sequence2.at(j))
break;
++count;
}
if(j ==sequence2.size()){
count = sequence2.size();
}
if(max < count)
max = count;
}
return 1.0*max/sequence2.size();
}
int main()
{
string str1, str2;
cout<<"Enter string 1: "<<endl;
getline(cin,str1);
cout<<"Enter string 2: "<<endl;
getline(cin,str2);
cout<<"Similarity Score is: "<<findBestMatch(str1, str2)<<endl;
return 0;
}
=========================================================================
See Output

Thanks, PLEASE RATE
In C++ please! Function 2. Find Best Match (40 points) We will use the term genome...
Python Write a function index_last(elem, seq) that takes as inputs an element elem and a sequence seq, and that uses recursion (i.e., that calls itself recursively) to find and return the index of the last occurrence of elem in seq. The sequence seq can be either a list or a string. If seq is a string, elem will be a single-character string; if seq is a list, elem can be any value. Don’t forget that the index of the first...
Just do program 6 using c++ which are printf and scanf. Please
don’t use cout and cin.
Program 4: A slot machine has three windows. A random fruit is picked for each window from cherry apple, lemon, and orange. If all three windows match, the user wins 8 times the bet amount. If the first two windows only are cherries, the user wins 3 times the bet amount. If the first window is a cherry and the second window is...
Coding for Python – don’t need it to be complex: In this assignment, your goal is to write a Python program to determine whether a given pattern appears in a data series, and if so, where it is located in the data series. This type of problem is common in many health disciplines. For example, identifying treatment pathways. The goal is to detect whether a certain pattern appears in the data series. In the following example, the pattern to be...
Write a python function score_formatter() that takes one parameter, which is a formatted string that contains information about the score received by a student in a particular subject. The function analyzes the string and returns a reformatted string for the score. You will need to use the function re.sub that is discussed in the lecture notes. If the string does not match the pattern, the function returns the string "error". The input string is always given in the format specified...
Help with programming in C++
Phase 1 is complete, please help with phase 2. Thank you.
Phase 1
You must design 3 algorithms, and provide
both a flow chart and pseudo code for the
algorithms.
Algorithm descriptions:
Given an integer parameter named current_number
and two constant global variables:
const int MIN_NUMBER = 1;
const int MAX_NUMBER = 8;
Create an algorithm named forward, that will
advance ONE value through a sequence of numbers 1,
2, 3 ... MAX_NUMBER. In...
Question 2 (10 points) (quality.py): We are provided with data from a quality control process in a manufacturing firm. The data file, "data.csv", contains several measurements. Each measurement is written in a separate line and each line contains two elements, the area where the measurement is made, and the measured value. These two values are separated with a comma (.). We are tasked to process this data in the following forms. a. First, we need to read the data from...
Need help problem 9-13
C++ Homework please help
WRITE FUNCTION PROTOTYPES for the following functions. The functions are described below on page 2. (Just write the prototypes) When necessary, use the variables declared below in maino. mm 1.) showMenu m2.) getChoice 3.) calcResult m.) showResult 5.) getInfo mm.) showName 7.) calcSquare 8.) ispositive int main { USE THESE VARIABLES, when needed, to write function prototypes (#1 - #8) double num1 = 1.5; double num2 = 2.5; char choice; double result;...
Please read the problem carefully and answer the 2 questions
below
code:
/*****************************************************************
* Program: palindrome.c
*
* Purpose: implements a recursive function for determining
* if a string is a palindrome
*
* Authors: Steven R. Vegdahl, Tammy VanDeGrift, Martin Cenek
*
*****************************************************************/
#include
#include
#include
/*****************************************************************
* is_palindrome - determines whether a string of characters is a
palindrome
*
* calling sequence:
* result = is_palindrome(str, first_index,
last_index)
*
* parameters -
* str - the string to test
* first_index -...
Coding for Python - The pattern detection problem – part 2:
def calculate_similarity_list(data_series,
pattern)
Please do not use 'print' or 'input'
statements.
Context of the assignment is:
In this assignment, your goal is to write a Python program to
determine whether a given pattern appears in a data series, and if
so, where it is located in the data series. Please see attachments
below:
We need to consider the following cases:
Case 1 - It is possible that the given...
Please use Java only. Write the class TopResult, which keeps track of the best (highest numbered or highest ordered) result it has seen so far. The class will be a generic type, so the type of results it sees depends on how it is declared. TopResult Task: There are a number of situations in which we want to keep track of the highest value we've seen so far - a highest score, a most recent entry, a name which is...