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

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 A 67 B 18 C 23 Even-digit count = 25 Odd-digit count = 14 Total digit count = 39

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_2

Step: 3

blur-text-image_3

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

Computer Organization and Design The Hardware Software Interface

Authors: David A. Patterson, John L. Hennessy

5th edition

124077269, 978-0124077263

More Books

Students also viewed these Programming questions