Write a program for random number generator, Programming Languages

Assignment Help:

* Comments in your code are required

* Main Program Operation:

 # Your program should first prompt the user for an integer to seed the random number Generator. "Enter an seed integer for random number generator:"

 #  Prompt the user to enter an integer to denote the number of values to create, n. The limit is100 numbers. "How many numbers to create:"

 #  Randomly generate and store the n integer values in the range of [-100,500]. Set argument $a0, the ID of the pseudorandom number generator to 8.

 # Write/Call a function to print the array values to the screen, printArray

 #  Write/Call a function for insertion sort, isort, to sort the values.

 #  Call printArray again to print the sorted values.

 # Prompt the user to enter a filename. "Enter input filename:"

- When reading in a string, the newline character is appended to the end if the string does not fill the buffer. Mars does not allow the newline character to be in the .filenamein order to open a file. You must delete/remove the newline character from thefilename string prior to opening the file (replace it with NULL).

# Use syscall 13 and 14 to open the file and read from the input file. Print error and reprompt forfilename if the file is not found. "Cannot open file." Make sure to open and close each fileproperly.

 # Write/Call a function, abcCount, to count the frequency of each alphabetic character in theinput file text.

 # Print the total number of characters counted.

# Write/Call a function, printTable, to print a table which displays the frequency of each letter.

 # Write/Call a function, ROT47Cipher, to encrypt the input text and print it to the screen.

 #  Prompt the user to enter 'E' to exit or 'R' to repeat the program.

Technical Specification:

The program should contain the following five functions:

 #isort: This function implements the iterative insertion sort algorithm.

* Input parameters: the base address of the array to be sorted, the number of elements in the array

  • Return parameter: Total sum of values sorted.

 

 #printArray: This function should print an array of integers to the screen.

* Input parameter: the base address of the array to be printed, number of elements to print.

* Return parameter: None

 #abcCount: This function examines each character in the text string and increments the countof the character in the array. Ignore any punctuation and spaces. Assume capital andlowercase letters are equivalent.

*   Input parameter: the base address of the array for storing the letter count, the base

address of the text string

* Return parameter: The total number of characters processed

# printTable: This function prints a two column table which displays the letter followed by itsfrequency count.

 

* Input parameter: the base address of the array for the frequency count, the number of

elements to print

  • Return parameter: None

a. ROT47: A substitution cipher in which uses the ASCII table to replace the plaintext withletters, numbers, and symbols. Specifically, the 7-bit printable characters from 0x21 '!' to

0x7E '~' (94 in total) are rotated by 47 positions. No special consideration is taken for

upper case and lower case, and the space character is left intact. For example, 'a' is

mapped to '2' and '9' is mapped to 'h'. (More details can be found here

https://en.wikipedia.org/wiki/ROT13). Note: Spaces are left untouched, but all other visiblesymbols are encrypted.

* Input parameter: the base address of the text string

* Return parameter: None

 # All functions should be called from the main program.

 # You may write additional functions if you choose. However, DO NOT deviate from the abovefunction specifications, redefine the parameters and/or functionality of the functions. Implement the functions and program as described above

  •  Data segment:

#  You should allocate space in your memory to generate at most 100 integer values, space for100,000 characters to be read from the text file, and space for storing the frequency of eachcharacter. Remember if you allocate your space after strings you must realign your memorysuch that the integer values are word aligned. Use the .align directive.

Enter 'E' to exit or 'R' to repeat: E

Testing:

your code must  assemble or operate correctly in MARS.


Related Discussions:- Write a program for random number generator

Apply generic algorithms in solving programming problems, Educational Objec...

Educational Objectives: After completing this assignment, the student should be able to accomplish the following: Apply generic algorithms in solving programming problems Define an

Programs to solve the nonlinear algebraic equations, Introduction Each...

Introduction Each module of the course includes a programming project. However, for Modules 5 and 6 we will do a single project to cover both. The purpose of the programming p

Algorithm to compute a minimum cover time and space, Given strings s 1 and...

Given strings s 1 and s 2 of lengths m and n respectively, a minimum cover of s 1 by s 2 is a decomposition s1 = w 1 w 2 .... wk, where each w i is a non-empty substring of s

Assembly language programm , these 8 numbers (15, 20, 25, 30, 35, 40, 45, a...

these 8 numbers (15, 20, 25, 30, 35, 40, 45, and 50) with using conditional jump

Difference between MOV and MOVS, 2. TEST & AND TEST is like CMP, it is used...

2. TEST & AND TEST is like CMP, it is used for conditional statement, and doesn’t save the answer. AND is logical multiplication. 3. INS & IN IN is used for data transfer from I/O

Output for the following instruction if CX=9087H AX=9090H, What will be the...

What will be the output for the following instruction if CX=9087H and AX=9090H? 1) BTR AH,2? 10010000=10010000 2) BTC CX,9?1001000010000111=1001000110000111 3) NEG AX?

Design a address book, Consider the operation of a line of supermarket chec...

Consider the operation of a line of supermarket checkouts and the profiles of customers and their shopping baskets. Use a random number generator to create the data for these profi

Flowchart and Pseudocode using Control Breaks, Shemrock Inc. is a brake pad...

Shemrock Inc. is a brake pad manufacturing company. This company uses raw materials, such as carbon powder, iron, ash, and resin. It wants to develop an inventory management system

Java applet assignment help, Objectives: Create an applet, Use metho...

Objectives: Create an applet, Use methods from the Graphics class , Use the Color class General Instructions: The java class that need to be imported into this assignm

Program compares interest rates, 'This program compares interest rates betw...

'This program compares interest rates between two banks and determines the best bank 'Eric Weber, Adam Litchfield, Eric Romero, Sarah, Alex, Amy '10/5/12 'Lab #4 Problem 42 'CSC

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