Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 2 3 The test file for character_finder function The Walnut Tree my head foaming clouds, sea inside me and out I am a walnut

image text in transcribed

1

image text in transcribed

2

image text in transcribed

3

The test file for "character_finder" function

The Walnut Tree

my head foaming clouds, sea inside me and out I am a walnut tree in Gulhane Park an old walnut, knot by knot, shred by shred Neither you are aware of this, nor the police

I am a walnut tree in Gulhane Park My leaves are nimble, nimble like fish in water My leaves are sheer, sheer like a silk handkerchief pick, wipe, my rose, the tear from your eyes My leaves are my hands, I have one hundred thousand I touch you with one hundred thousand hands, I touch Istanbul My leaves are my eyes, I look in amazement I watch you with one hundred thousand eyes, I watch Istanbul Like one hundred thousand hearts, beat, beat my leaves

I am a walnut tree in Gulhane Park neither you are aware of this, nor the police

Nazim Hikmet

translated from Turkish by Gun Gencer

You will write a function called as "character_finder" which will find the number of existence of as specific character in a text file. The function will take two input arguments; i) fileName" as the char vector of the filename and ii) the character as the specific character that will be counted. The returning argument will be called as numberOfChar, the number of characters that are found. If the input argument character is not a valid char or if the file does not exist in the working directory, the function will return -1. The test file that can be used to test your code is attached to this question with the name of "test_file.txt. Please test your code with that file and compare your results with the below test cases. Example usages of the function is given below; Please upload your written function as a m.file (if .m file type is not supported, please upload your function as a .txt file). >> charnum = character finder ('test file.txt', 't') please upload your function as a .txt file). >> charnum = character_finder('test_file.txt', 't') charnum = 39 >> charnum = character_finder('test_file.txt', 'f') charnum = 7 >> charnum = character_finder('test_file.txt', 'T') charnum = charnum 39 >> charnum = character_finder('test_file.txt', 'f') charnum = 7 >> charnum = character_finder ('test_file.txt', 'T) charnum = 3 >> charnum = character_finder ("test_file.txt', '&') charnum = 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions