Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started