Implement the scoreTypo function in the following program: #include #include #include using namespace std; int scoreTypo(const string dictionary[], int n, string word) { Replace this line with your...

1 answer below »
DUMMY


Implement the scoreTypo function in the following program: #include #include #include using namespace std; int scoreTypo(const string dictionary[], int n, string word) { Replace this line with your implementation } int main() { // Here are some tests. You may add more if you wish. string dict1[6] = { "february", "pointer", "country", "forty", "conversation", "minuscule" }; assert(scoreTypo(dict1, 0, "forty") == -1); assert(scoreTypo(dict1, 6, "forty") == 0); assert(scoreTypo(dict1, 6, "fourty") == 1); assert(scoreTypo(dict1, 6, "febuary") == 1); assert(scoreTypo(dict1, 6, "miniscule") == 1); assert(scoreTypo(dict1, 6, "poitner") == 1); assert(scoreTypo(dict1, 6, "conservation") == 2); cout < "all="" tests="" succeeded"="">< endl; } the scoretypo function considers only the first n elements of the array passed to dictionary. you may assume that word and that every string in dictionary consists of at least one lower case letter and contains no character that is not a lower case letter. (so we promise that we will not pass strings like "", "ebay", "half-wit", "be at", or "hen3ry" to this function.) if n is not positive, scoretypo returns −1; otherwise, it returns the smallest typo score among all the typo scores between word and each string in dictionary. let's define a simple typo of a string as one of the following: · adding exactly one character to the string (e.g., adding one character to forty to produce fourty) · removing exactly one character from the string (e.g., removing a character from february to produce febuary) · replacing exactly one character in the string (e.g., replacing a character in minuscule to produce miniscule) · swapping two adjacent characters in the string (e.g., swapping two adjacent characters of pointer to produce poitner) the typo score between two strings is defined to be · 0 if the strings are identical · 1 if exactly one simple typo would transform one string to the other · 2 if neither of the above two conditions hold for example, the typo score between country and fourty is 2, while the typo score between forty and fourty is 1. in the example program above, 1 is the smallest typo score among all the typo scores between fourty and each word in dict1. the source file named typo.cpp that you turn in will contain the entire program above. you can actually have the main routine do whatever you want, because we will rename it to something harmless, never call it, and append our own main routine to your file. our main routine will thoroughly test your function. you'll probably want your main routine to do the same. if you wish, you may add helper functions that your implementation of scoretypo calls. the program you turn in must build successfully, and during execution, no function (other than main) may read anything from cin or write anything to cout. if you want to print things out for debugging purposes, write to cerr instead of cout. when we test your program, we will cause everything written to cerr to be discarded instead — we will never see that output, so you may leave those debugging output statements in your program if you wish. although our test routine will call your function passing values for n that are less than or equal to the number of elements in the array passed as dictionary, we will never pass a value for n than is greater than the number of elements in the array passed as dictionary. hwc maths 204-1 spring 2021 midterm test name__________________________ 1. a bank offers a 10-year cd that earns 2.45% compounded continuously. - if $ 6000 is invested in this cd, how much will it worth in 10 years? -how long will it take for the account to be worth $9000? 2. find the equation of the line tangent to the graph of f(x) = 2 + lnx at the point x=1: 3. find the derivative of: f(x) = (2x+1)(x2 – 3x) 4. find df/dx of f(x) =(3x + 5)/(x2 + 3) 5. find the derivative of: f(x) = ln(x4 +1) 6. find y’ when y = 5(x2 – 3)2 7. find f’(x) of f(x) = x2(x – 5)3 and find the values of x where the tangent line is horizontal. 8. use implicit differentiation to find y’ and to evaluate y’ at the point (-1, 1) when y2 + 2y +3x = 0 9. assume that x= x(t) and y= y(t), find the rate of change of y = x3 +2 when x’ = 4 and x= 5 10. use a graphing calculator to graph f(x) = 2x 3 -- 3x 2 -- 36x determine the intervals on which f(x) is: increasing decreasing concave upward concave downward ---------------------------------------- the local minimum the local maximum the point of inflection 11. find the second derivative for f(x) = 2x3 – 4x2 + 5x -- 6 f’(x) = the critical values f’(x) = 0 x = ___ f(x) =___ the points of inflection f’’(x) = 0 x = ___ f(x) = __ 12. if it’s necessary, use the hopital’s rule to find: lim (5x)/ (ex – 1) x (0 13. if it’s necessary, use the hopital’s rule to find: lim (x2 – 9)/(x + 3) x(-- 3 14. for f(x) = x3 – 6x2 + 9x – 6 in the interval [- 1, 5] find algebraically: f’(x) = f’(x) = 0 f’(-1) = f”( x ) = f”(x) = 0 f”( 5 ) = absolute maximum( , ) absolute minimum( , ) page 4 assignment 1_isys350_summer2021 1. sales tax write a program that will ask the user to enter the amount of a purchase. the program should then compute the state and county sales tax. assume the state tax is 8 percent and county tax is 3.5 percent. the program should display the amount of the purchase, the state sales tax and the county sales tax, total sales tax, and the total of the sale (which is the sum of the amount purchase plus total sales tax). 2. celsius to fahrenheit temperature converter write a program that converts celsius temperatures to fahrenheit temperatures. the formula is as follows: f = (9/5)*c +32 the program should ask the user to enter a temperature in celsius, then display the temperature converted to fahrenheit. 3. book club points serendipity booksellers has a book club that awards points to its customers based on the number of books purchased each month. the points are awarded as follows: • if a customer purchases 0 books, he or she earns 0 points. • if a customer purchases 1 book, he or she earns 6 points. • if a customer purchases 2 books, he or she earns 16 points. • if a customer purchases 3 books, he or she earns 32 points. • if a customer purchases 4 or more books, he or she earns 60 points. write a program that asks the user to enter the number of books that he or she has purchased this month and displays the number of points awarded. endl;="" }="" the scoretypo function="" considers="" only="" the="" first n elements="" of="" the="" array="" passed="" to dictionary.="" you="" may="" assume="" that word and="" that="" every="" string="" in dictionary consists="" of="" at="" least="" one="" lower="" case="" letter="" and="" contains="" no="" character="" that="" is="" not="" a="" lower="" case="" letter.="" (so="" we="" promise="" that="" we="" will="" not="" pass="" strings="" like "", "ebay", "half-wit", "be="" at",="" or "hen3ry" to="" this="" function.)="" if n is="" not="" positive, scoretypo returns="" −1;="" otherwise,="" it="" returns="" the="" smallest typo="" score among="" all="" the="" typo="" scores="" between word and="" each="" string="" in dictionary.="" let's="" define="" a simple="" typo of="" a="" string="" as="" one="" of="" the="" following:="" ·="" adding="" exactly="" one="" character="" to="" the="" string="" (e.g.,="" adding="" one="" character="" to forty to="" produce fourty)="" ·="" removing="" exactly="" one="" character="" from="" the="" string="" (e.g.,="" removing="" a="" character="" from february to="" produce febuary)="" ·="" replacing="" exactly="" one="" character="" in="" the="" string="" (e.g.,="" replacing="" a="" character="" in minuscule to="" produce miniscule)="" ·="" swapping="" two="" adjacent="" characters="" in="" the="" string="" (e.g.,="" swapping="" two="" adjacent="" characters="" of pointer to="" produce poitner)="" the typo="" score between="" two="" strings="" is="" defined="" to="" be="" ·="" 0="" if="" the="" strings="" are="" identical="" ·="" 1="" if="" exactly="" one="" simple="" typo="" would="" transform="" one="" string="" to="" the="" other="" ·="" 2="" if="" neither="" of="" the="" above="" two="" conditions="" hold="" for="" example,="" the="" typo="" score="" between country and fourty is="" 2,="" while="" the="" typo="" score="" between forty and fourty is="" 1.="" in="" the="" example="" program="" above,="" 1="" is="" the="" smallest="" typo="" score="" among="" all="" the="" typo="" scores="" between fourty and="" each="" word="" in dict1.="" the="" source="" file="" named typo.cpp that="" you="" turn="" in="" will="" contain="" the="" entire="" program="" above.="" you="" can="" actually="" have="" the="" main="" routine="" do="" whatever="" you="" want,="" because="" we="" will="" rename="" it="" to="" something="" harmless,="" never="" call="" it,="" and="" append="" our="" own="" main="" routine="" to="" your="" file.="" our="" main="" routine="" will="" thoroughly="" test="" your="" function.="" you'll="" probably="" want="" your="" main="" routine="" to="" do="" the="" same.="" if="" you="" wish,="" you="" may="" add="" helper="" functions="" that="" your="" implementation="" of scoretypo calls.="" the="" program="" you="" turn="" in="" must="" build="" successfully,="" and="" during="" execution,="" no="" function="" (other="" than="" main)="" may="" read="" anything="" from cin or="" write="" anything="" to cout.="" if="" you="" want="" to="" print="" things="" out="" for="" debugging="" purposes,="" write="" to cerr instead="" of cout.="" when="" we="" test="" your="" program,="" we="" will="" cause="" everything="" written="" to cerr to="" be="" discarded="" instead="" —="" we="" will="" never="" see="" that="" output,="" so="" you="" may="" leave="" those="" debugging="" output="" statements="" in="" your="" program="" if="" you="" wish.="" although="" our="" test="" routine="" will="" call="" your="" function="" passing="" values="" for n that="" are="" less="" than="" or="" equal="" to="" the="" number="" of="" elements="" in="" the="" array="" passed="" as dictionary,="" we="" will="" never="" pass="" a="" value="" for n than="" is greater than="" the="" number="" of="" elements="" in="" the="" array="" passed="" as dictionary.="" hwc="" maths="" 204-1="" spring="" 2021="" midterm="" test="" name__________________________="" 1.="" a="" bank="" offers="" a="" 10-year="" cd="" that="" earns="" 2.45%="" compounded="" continuously.="" -="" if="" $="" 6000="" is="" invested="" in="" this="" cd,="" how="" much="" will="" it="" worth="" in="" 10="" years?="" -how="" long="" will="" it="" take="" for="" the="" account="" to="" be="" worth="" $9000?="" 2.="" find="" the="" equation="" of="" the="" line="" tangent="" to="" the="" graph="" of="" f(x)="2" +="" lnx="" at="" the="" point="" x="1:" 3.="" find="" the="" derivative="" of:="" f(x)="(2x+1)(x2" –="" 3x)="" 4.="" find="" df/dx="" of="" f(x)="(3x" +="" 5)/(x2="" +="" 3)="" 5.="" find="" the="" derivative="" of:="" f(x)="Ln(x4" +1)="" 6.="" find="" y’="" when="" y="5(x2" –="" 3)2="" 7.="" find="" f’(x)="" of="" f(x)="x2(X" –="" 5)3="" and="" find="" the="" values="" of="" x="" where="" the="" tangent="" line="" is="" horizontal.="" 8.="" use="" implicit="" differentiation="" to="" find="" y’="" and="" to="" evaluate="" y’="" at="" the="" point="" (-1,="" 1)="" when="" y2="" +="" 2y="" +3x="0" 9.="" assume="" that="" x="x(t)" and="" y="y(t)," find="" the="" rate="" of="" change="" of="" y="x3" +2="" when="" x’="4" and="" x="5" 10.="" use="" a="" graphing="" calculator="" to="" graph="" f(x)="2x" 3="" --="" 3x="" 2="" --="" 36x="" determine="" the="" intervals="" on="" which="" f(x)="" is:="" increasing="" decreasing="" concave="" upward="" concave="" downward="" ----------------------------------------="" the="" local="" minimum="" the="" local="" maximum="" the="" point="" of="" inflection="" 11.="" find="" the="" second="" derivative="" for="" f(x)="2x3" –="" 4x2="" +="" 5x="" --="" 6="" f’(x)="The" critical="" values="" f’(x)="0" x="___" f(x)="___" the="" points="" of="" inflection="" f’’(x)="0" x="___" f(x)="__" 12.="" if="" it’s="" necessary,="" use="" the="" hopital’s="" rule="" to="" find:="" lim="" (5x)/="" (ex="" –="" 1)="" x="" (0="" 13.="" if="" it’s="" necessary,="" use="" the="" hopital’s="" rule="" to="" find:="" lim="" (x2="" –="" 9)/(x="" +="" 3)="" x(--="" 3="" 14.="" for="" f(x)="x3" –="" 6x2="" +="" 9x="" –="" 6="" in="" the="" interval="" [-="" 1,="" 5]="" find="" algebraically:="" f’(x)="F’(x)" =="" 0="" f’(-1)="F”(" x="" )="F”(x)" =="" 0="" f”(="" 5="" )="Absolute" maximum(="" ,="" )="" absolute="" minimum(="" ,="" )="" page="" 4="" assignment="" 1_isys350_summer2021="" 1.="" sales="" tax="" write="" a="" program="" that="" will="" ask="" the="" user="" to="" enter="" the="" amount="" of="" a="" purchase.="" the="" program="" should="" then="" compute="" the="" state="" and="" county="" sales="" tax.="" assume="" the="" state="" tax="" is="" 8="" percent="" and="" county="" tax="" is="" 3.5="" percent.="" the="" program="" should="" display="" the="" amount="" of="" the="" purchase,="" the="" state="" sales="" tax="" and="" the="" county="" sales="" tax,="" total="" sales="" tax,="" and="" the="" total="" of="" the="" sale="" (which="" is="" the="" sum="" of="" the="" amount="" purchase="" plus="" total="" sales="" tax).="" 2.="" celsius="" to="" fahrenheit="" temperature="" converter="" write="" a="" program="" that="" converts="" celsius="" temperatures="" to="" fahrenheit="" temperatures.="" the="" formula="" is="" as="" follows:="" f="(9/5)*C" +32="" the="" program="" should="" ask="" the="" user="" to="" enter="" a="" temperature="" in="" celsius,="" then="" display="" the="" temperature="" converted="" to="" fahrenheit.="" 3.="" book="" club="" points="" serendipity="" booksellers="" has="" a="" book="" club="" that="" awards="" points="" to="" its="" customers="" based="" on="" the="" number="" of="" books="" purchased="" each="" month.="" the="" points="" are="" awarded="" as="" follows:="" •="" if="" a="" customer="" purchases="" 0="" books,="" he="" or="" she="" earns="" 0="" points.="" •="" if="" a="" customer="" purchases="" 1="" book,="" he="" or="" she="" earns="" 6="" points.="" •="" if="" a="" customer="" purchases="" 2="" books,="" he="" or="" she="" earns="" 16="" points.="" •="" if="" a="" customer="" purchases="" 3="" books,="" he="" or="" she="" earns="" 32="" points.="" •="" if="" a="" customer="" purchases="" 4="" or="" more="" books,="" he="" or="" she="" earns="" 60="" points.="" write="" a="" program="" that="" asks="" the="" user="" to="" enter="" the="" number="" of="" books="" that="" he="" or="" she="" has="" purchased="" this="" month="" and="" displays="" the="" number="" of="" points="">
Answered 8 days AfterAug 17, 2021

Answer To: Implement the scoreTypo function in the following program: #include #include #include using...

Mohit answered on Aug 25 2021
139 Votes
Assignment 1_ISYS350_Summer2021
1. Sales Tax Write a program that will ask the user to enter the a
mount of a purchase. The program should then compute the state and county sales tax. Assume the state tax is 8 percent and county tax is 3.5 percent. The program should display the amount of the purchase, the state sales tax and the county sales tax, total sales tax, and the total of the sale (which is the sum of the amount purchase plus total sales tax).
2. Celsius to Fahrenheit Temperature Converter Write a program that converts Celsius temperatures to Fahrenheit temperatures. The formula is as follows: F = (9/5)*C +32 The program should ask the user to enter a temperature in Celsius, then display the temperature converted to Fahrenheit.
3. Book Club Points Serendipity Booksellers has a book club that awards points to its customers based on the number of books purchased each month. The points...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here