Write a Matlab program to accept a string as input and determine if this string is...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Matlab program to accept a string as input and determine if this string is a palindrome. A palindrome is a sentence that reads the same backward as forward, such as "Reward a Toyota drawer" or Napoleon's classic lament, "Able was I ere I saw Elba". Punctuation marks, blanks, and letter cases shall have no effects. Therefore your program should remove punctuation marks and blanks first, convert all letters to lowercase, then determine if the resulting string reads the same backward as forward. Output appropriate messages. You cannot use the built-in functions upper, lower, deblank, or isletter. Run your program with the two sentences given above, then "Today is such a nice day!" and "A man, a plan, a cat, a canal: Panama!" Write a Matlab program to accept a string as input and determine if this string is a palindrome. A palindrome is a sentence that reads the same backward as forward, such as "Reward a Toyota drawer" or Napoleon's classic lament, "Able was I ere I saw Elba". Punctuation marks, blanks, and letter cases shall have no effects. Therefore your program should remove punctuation marks and blanks first, convert all letters to lowercase, then determine if the resulting string reads the same backward as forward. Output appropriate messages. You cannot use the built-in functions upper, lower, deblank, or isletter. Run your program with the two sentences given above, then "Today is such a nice day!" and "A man, a plan, a cat, a canal: Panama!"
Expert Answer:
Answer rating: 100% (QA)
Here is a MATLAB program that checks if a given string is a palindrome by removing p... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these operating system questions
-
Portray in words what transforms you would have to make to your execution to some degree (a) to accomplish this and remark on the benefits and detriments of this thought.You are approached to compose...
-
Jen and Barry's Ice Milk Company used cash to purchase a new ice milk mixer on January 1, 2013. The new mixer is estimated to have a 20,000 - hour service life. Jen and Barry's depreciates equipment...
-
Poll your classmates about their attitudes toward "globalization." What are the trends and opinions around the world that underlie those attitudes?
-
Suppose that the spot rates of the U.S. dollar, British pound, and Swedish kronor are quoted in three locations as the following: Is there an arbitrage opportunity? If so, explain how you, as a...
-
Let \(Z\) be a Brownian motion defined in [0,T]. Given a partition \(\mathscr{P}\) such that \(0=t_{0}
-
Figure P36.40 shows a thin glass (n = 1.50) converging lens for which the radii of curvature are R1 = 15.0 cm and R2 = -12.0 cm. To the left of the lens is a cube having a face area of 100 cm2. The...
-
4. Let f(x, z) = C ([0, 1] R) be strictly convex with respect to its second argument and define for y(x) = C[0,1], J (y) = [* f(x, y'(x)) dx. (a) (7 points) Consider J(y; v) on the set D = {y C [0,...
-
The information listed below refers to the employees of Lemonica Company for the year ended December 31, 2016. The wages are separated into the quarters in which they were paid to the individual...
-
The steam supplied to nozzle at 7 bar and 250 and leave at pressure 0-9 bar and the nozzle angle is 200. The blade velocity is 300 m/s and mass flow rate is 0.9 kg/s, and If the ratio of relative...
-
Harmony Services, Inc. has 58 employees. The company would like to implement an employer-sponsored retirement plan with flexible contributions. The census indicates that integration with Social...
-
Consider a \($180,000\) 30-year fixed-rate mortgage with a nominal interest rate of 6%. Suppose that after paying the first 12 monthly payments, the borrower decides that she cannot pay more than...
-
Suppose the U.S. government defaults on its payments (i.e., cannot pay T-bills at their maturity date). What would be the effect on the T-bill rate? What would be the effect on the interest rates of...
-
Which organization allows for a charitable deduction to a foreign organization? I. U.S. Friends of organizations. II. Donor-advised fundsforeign. III. Public foundationsforeign. IV. Supporting...
-
Which of the following is the most suitable response for risks that involve high loss severity and low loss frequency? A. Risk avoidance. B. Risk diversification. C. Risk reduction. D. Risk transfer.
-
ABC Bank of the United States has a portfolio of DM 20 million and BP 25 million. DM (the currency of Germany, and BP is the British pound, the British currency). The spot rates are $0.4/DM and...
-
Conduct a VRIO analysis by ranking Husson University (in Maine) business school in terms of the following six dimensions relative to the top three rival schools. If you were the dean with a limited...
-
What changes to the ChangeMaker program in Listing 2.3 are necessary if it also accepts coins for one dollar and half a dollar? Listing 2.3 import java.util.Scanner; public class ChangeMaker { public...
-
Define an enumeration for each of the months in the year. Use a for-each statement to display each month.
-
Derive a class ExaggeratingKid from SchoolKid, as described in the previous exercise. The new class should override the accessor method for the age, reporting the actual age plus 2. It also should...
-
By using the yield to maturity on AT&Ts debt, we found that its pretax cost of debt is 3.65%. If AT&Ts tax rate is 25%, what is its effective cost of debt?
-
You work in Walt Disney Companys corporate finance and treasury department and have been assigned to the team estimating Disneys WACC. You must estimate this WACC in preparation for a team meeting...
-
You are working for Microsoft evaluating the possibility of selling energy drinks. Microsofts WACC is 8.1%. Energy drinks would be a new line of business for Microsoft, however, so the systematic...
Study smarter with the SolutionInn App