EECS 1570 Winter 2020 Assignment 4 Due: Thursday March 19, 2020 by 10:55 p.m.
- This assignment is worth 6% of your final grade. 2. Submit your solution files electronically through the course Moodle. 3. A list of the files to submit is found at the end of this assignment.
Questions: 1. (8 points) Write a user-defined MATLAB function named word2piglatin that receives a word as input and returns a pig Latin translation of the word. Both the input word and the pig Latin word are character arrays. The pig Latin translation involves first determining if the input word begins with a vowel (a, e, i, o, or u). If so, append ‘way’ to form the pig Latin translation. If the input word does not begin with a vowel, then form the pig Latin translation by moving the first letter to the end of the word and then appending ‘ay’. Some example translations are skip kipsay to otay all allway Include documentation for help. Test your function in MATLAB’s command window. An example follows. User input is underlined. >> help word2piglatin word2piglatin – convert a word to pig Latin word2piglatin(word) receives an input word as a character array and returns a pig Latin translation of the word, also a character array. Forming the pig Latin of a word involves moving the first letter of the word to the end of the word, then appending ‘ay’, for example, the pig Latin for ‘trim’ is ‘rimtay’. An exception is words beginning with a vowel: just append ‘way’. So, the pig Latin for ‘and’ is ‘andway’. Author: , ,
Once you are a confident your word2piglatin function is working properly, write a MATLAB test program named a4q1.m that uses the function. This program should prompt the user to enter a phrase. Input the phrase, then output the translated phrase in the command window. Below is an example dialog. User input is underlined.