Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write and test a MIPS assembly language program to count each letter, each even digit, and each odd digit in a text file. The program

image text in transcribed

Write and test a MIPS assembly language program to count each letter, each even digit, and each odd digit in a text file. The program should do the following: a) Open a text file "input.txt" and read all characters into an array. Limit the length of the array to 10000 characters. The maximum number of characters to be read should be 10000 characters. MARS provides the system calls for opening and reading a text file. If the file does not exist then the program should display an error message and terminates b) Traverse the array character by character. Count all letters and digits while ignoring the other characters. You should use an array of 26 integer counters for the 26 letters in the alphabet, and two integer counters; one counter to count the even digits in the file, and the other counter to count the odd digits in the file. Do not distinguish between capital and lowercase letter; both should be counted as the same letter c) Display the count of each letter as well as the even-digit count, the odd-digit counts, and the total digit count. A sample run is shown below: Letter Count 67 18 23 5 Even-digit count = 25 Odd-digit count 14 Total digit count39 Write and test a MIPS assembly language program to count each letter, each even digit, and each odd digit in a text file. The program should do the following: a) Open a text file "input.txt" and read all characters into an array. Limit the length of the array to 10000 characters. The maximum number of characters to be read should be 10000 characters. MARS provides the system calls for opening and reading a text file. If the file does not exist then the program should display an error message and terminates b) Traverse the array character by character. Count all letters and digits while ignoring the other characters. You should use an array of 26 integer counters for the 26 letters in the alphabet, and two integer counters; one counter to count the even digits in the file, and the other counter to count the odd digits in the file. Do not distinguish between capital and lowercase letter; both should be counted as the same letter c) Display the count of each letter as well as the even-digit count, the odd-digit counts, and the total digit count. A sample run is shown below: Letter Count 67 18 23 5 Even-digit count = 25 Odd-digit count 14 Total digit count39

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

Students also viewed these Databases questions

Question

Describe loss aversion and myopic loss aversion.

Answered: 1 week ago

Question

Analyze the impact of labor unions on health care.

Answered: 1 week ago

Question

Assess three motivational theories as they apply to health care.

Answered: 1 week ago

Question

Discuss the history of U.S. labor unions.

Answered: 1 week ago