logo Hurry, Grab up to 30% discount on the entire course
Order Now logo
1133 Times Downloaded

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Elyza Marice GamisManagement
(5/5)

589 Answers

Hire Me
expert
Victor BarbeauuLaw
(5/5)

755 Answers

Hire Me
expert
Henry SimmonsEnglish
(5/5)

887 Answers

Hire Me
expert
ShreyeshComputer science
(/5)

825 Answers

Hire Me
MATLAB
(5/5)

The function receives a character array rowOfData and a number col as input. The character array

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

MATLAB 

Instructions

Complete the following problems as part your exam. Submit the code for each function via Canvas. When submitting the code for a function, make sure the file is named accordingly. For example, when submitting the code for getRotatedPoint, the file containing the code must be named getRotatedPoint.m and must remain that regardless of you completing a new submission. If you overwrite a previous your submission in Canvas, make sure you overwrite your complete submission (i.e., submit all files every time you complete a submission even if you only are trying to update one file); otherwise, Canvas will show an incomplete submission as the last one.

Testing for Boundary Conditions

As part of the exam, you are provided some examples of function calls and along with the values returned by the sample function calls. However, you are responsible for making sure your functions work under different boundary conditions that result from the range of input values possible as well as addressing the full instructions in the problem statement. The identification of boundary conditions and correctly structuring the code to handle such scenarios is a key component of the exam. Therefore, do not assume that all possible input and expected value combinations are shown, e.g., do not hardcode behaviors, your code must provide the general solution.

Problem 01       [3 pts]

The function receives the x-y coordinates coords1 and coords2 that can be used to define two lines. The information that defines each line is passed as input in [x1, y1, x2, y2] form. The function returns the two angles defined by the intersection of the two lines in [smallest, largest] form. If the lines do not intersect, then the function returns [0, 0].

Function Name and Parameters

intersectionAngle(coords1, coords2)

Sample Function Call

Returned

intersectionAngle([5,6,9,4], [4,5,8,6])

[40.6013, 139.3987]

intersectionAngle([6,7,8,3], [4,5,8,6])

[77.4712, 102.5288]

Problem 02      [2 pts]

The function receives a character array rowOfData and a number col as input. The character array rowOfData represents a row of data in a comma-separated values (CSV) format. The number col represents the column of interest within the row of data. The function returns the value (as a character array or double) associated with the column. Therefore, if the value can be represented as a double then a double must be returned; if not, a character array must be returned. If an invalid column number is passed, the function returns the MATLAB NaN value.

Function Name and Parameters

getValueAtColumn(rowOfData, col)

Sample Function Call

Returned

getValueAtColumn('a,b,c', 2)

'b'

getValueAtColumn('a,b,34', 3)

[34.0000]

getValueAtColumn('20.52,ced', 1)

[20.5200]

getValueAtColumn('a,b,34', 4)

NaN

Problem 03      [2 pts]

The function receives character array cArr as input. The function sequentially evaluates every character in the array and returns the number of times there is a change in the case of the cArr characters. A non a-z/A-Z character should be treated as having the case of the last a-z/A-Z character (in left to right order).

Function Name and Parameters

caseChangeCount(cArr)

Sample Function Call

Returned

caseChangeCount('aBcrela')

[2]

caseChangeCount('rTREmnM')

[3]

caseChangeCount('aaaerw')

[0]

Problem 04      [2 pts]

The function receives a character array cArr as input. The function returns a sorted version of the array (in ascending order) in which the first part of the array contains the sorted version of the lowercase characters while the second part contains the sorted version of the uppercase characters. You can assume that the character array passed as input contains only a-z or A-Z characters. Please note that only unique characters are included in the value returned.

Function Name and Parameters

sortSplitCase(cArr)

Sample Function Call

Returned

sortSplitCase('aaDremE')

'aemrDE'

sortSplitCase('avttea')

'aetv'

sortSplitCase('PMEDDC')

'CDEMP'

Problem 05       [2 pts]

The function receives a character array nameStr containing a full name in uppercase, lowercase, or a mixed format as input. The function returns a character array file with the full named passed as input but formatted using sentence case. For simplicity purposes, you can assume that names only contain a-z or A-Z characters.

Function Name and Parameters

fixNameFormat(nameStr)

Sample Function Call

Returned

fixNameFormat('John SMITH')

'John Smith'

fixNameFormat('JANE DOE')

'Jane Doe'

fixNameFormat('JoHn SMITH')

'John Smith'

fixNameFormat('JANe DOe')

'Jane Doe'

fixNameFormat('')

''

Problem 06      [3 pts]

The function receives a character array myStr as input. The function returns a logical value indicating if the character array passed is symmetrical (i.e. a palindrome) or not. An empty character array passed as input must be treated as symmetrical. The presence of a non A-Z or a-z character results in the function returning an empty array. Notice that logical(1) and logical(0) are simply used to indicate that a logical value is returned; it does not mean that the function returns a character array that reads like 'logical(1)'. The function is case-sensitive.

Function Name and Parameters

isSymmetrical(myStr)

Sample Function Call

Returned

isSymmetrical('aba')

logical(1)

isSymmetrical('abba')

logical(1)

isSymmetrical('aara')

logical(0)

isSymmetrical('a##a')

[]

isSymmetrical('')

logical(1)

 

(5/5)
Attachments:

Expert's Answer

1133 Times Downloaded

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme