CS 1371 HW, MATLAB Programming

Assignment Help:
Function Name: voteCounter

Inputs (1): - (char) filename of votes

Outputs (0): - none

Function Description:

You use the brand new VoteMaster 3000 to tally up votes in the recent

elections of some of your extracurricular organizations. To your dismay,

it only outputs a txt file with a title describing the election and a

list of the candidates'' names, with each line representing a vote for

that candidate.

In addition to suing the VoteMaster 3000 makers for false advertising,

you now have to create a MATLAB function named voteCounter that takes in

the txt file of names and writes another txt file containing the

candidates and their respective votes, in descending order. Furthermore,

the filename of the written txt file should be the first line of the

input txt file.

For example, if the input txt file contained

1371 Head TA Elections

McGraw

Carter

Tahler

Bragg

Carter

your written txt file should be named ''1371 Head TA Elections.txt'' and contain

Carter 2

McGraw 1

Tahler 1

Bragg 1

Notes:

- in the written text file, there is a space between the candidate name

and his/her number of votes

- in the event of a tie, the candidate who appears first in the input

file wins (the sort function should take care of this)

- there should be no empty line at the end of your written file (i.e. the

last line of your written file should be the candidate who received the

least number of votes)

- PLEASE open the txt files in MATLAB to avoid confusion with new lines.

Related Discussions:- CS 1371 HW

Printing vectors and matrices, Printing Vectors and Matrices: For vect...

Printing Vectors and Matrices: For vector, if the conversion character and newline character are in the format string, it will print in a column in spite of of whether the vec

Write a matlab program, Write a MATLAB program (using/making the necessary ...

Write a MATLAB program (using/making the necessary functions that you deem necessary) that does the two following jobs: It generates the following digital modulation schemes. In

Recognizing people in video based on their body", I am doing project "Recog...

I am doing project "Recognizing people in video based on their body" the system will use MATLAB to detect people based on thier body and then recognize them from their clothes "us

Printing - matrices, Printing - matrices: For matrices, the MATLAB unw...

Printing - matrices: For matrices, the MATLAB unwinds the matrix column by column. For illustration, consider the random 2 × 3 matrix as shown below: >> mat = randint(2,3,[

Calling an user-defined function from script, Calling an User-Defined Funct...

Calling an User-Defined Function from Script: Now, we will change our script which prompts the user for the radius and computes the area of a circle, to call our function cal

3-A-Day, Savannah says that the least common multiple of 4 and 6 is 24. Is ...

Savannah says that the least common multiple of 4 and 6 is 24. Is she right or what is her mistake?

A matlab program to produce a map of the route, Micro-mouse is an engineeri...

Micro-mouse is an engineering design competition created by IEEE in the late 1970s. Small robotic "mice" solve a 16x16 cell maze. The mice are completely autonomous and must find t

Calculate the distance between the two cars, Two cars started to move from ...

Two cars started to move from zero position with (φ = 35) as shown. For the next four minutes, do the following: 1. Calculate each car's distance from the zero position (Distanc

Command window, Command Window: To the left of the Command Window, the...

Command Window: To the left of the Command Window, there are 2 tabs for the Current Directory Window and Workspace Window. If the Current Directory tab is selected, the files

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd