Question

In: Computer Science

1-) Please submit the solution of your final as Ms-word or PDF document 2-) Complete THREE...



1-) Please submit the solution of your final as Ms-word or PDF document

2-) Complete THREE QUESTIONS out of the four exam questions below.

3-) FOR EACH QUESTION, IT IS REQUIRED to include Ms-Word or Pdf file contains the following

A. Source file and sample of your output screen shots.

B. Up to one page of your program discussion. In the discussion, state the issues that you may have problem with if there is any. Why your program is not running (if it is not)? What was your approach (Your process to the solution)? How did you overcome the issues while writing the program?

C. Write your conclusion as what you have learned from this program.

Not including this report will result of losing 30% because I would not know if you really the one who did it or not.

YOUR REPORT WILL VERIFY THE UNDERSTANDING OF YOUR WORK, AND THAT YOU REALLY DID IT.


Question One: Write an assembly language program that allows a user to enter any 5 numbers then display the sum of the entered 5 numbers.

For example:

Enter: 1, 2, 3, 4, 5

Output First Line: Display: Sum of the Entered is: 15

Output Second Line: Display: Division of entered digit number 4 by entered digit number two 2 so (4/( 2 = 2)

Question Two: Write an assembly language program that allows a user to enter any 6 numbers in any order then display the largest and smallest entered number and the order from small to large and then large to small

For example

Enter: 4, , 2, 7, 9, 6, 1

Display:

Largest entered number is: 9

Smallest entered number is: 1

Large to Small: 9, 7, 6, 4, 2, 1

Small to Large: 1, 2, 4, 6, 7, 9


Question Three: Write an assembly language program to count number of vowels in any given string.

Question Four: Write a procedure named Get_frequencies that constructs a character frequency table. Input to the procedure should be a pointer to a string, and a pointer to an array of 256 doublewords. Each array position is indexed by its corresponding ASCII code. When the procedure returns, each entry in the array contains a count of how many times that character occurred in the string. Include the source code only.

Solutions

Expert Solution

The assembly code for A is as follows:

assume cs:code, ds:data

data segment
     msg1 db "Enter 5 numbers:$"
     msg3 db 10,13,"$" ; msg to display newline
     msg2 db 10,13,"The sum of the entered numbers is:$"
     msg4 db 10,13,"Division of entered number 4 by entered number 2 is:$"
     sum db 0
     digit2 db ?
     digit4 db ?
data ends

code segment
start:
; set segment registers:
    mov ax, data
    mov ds, ax ; initialize the data segment
    lea dx, msg1
    mov ah, 09
    int 21h ; display msg1 using the above code
    lea dx, msg3
    mov ah, 09
    int 21h; display msg3      
    mov cx,05 ; initialize cx with count of numbers to be read
up:
    mov ah,01h
    int 21h ; read a number
    sub al,30h ; the ascii value of number is read
    ; for eg, if 1 is read, 31h will be available in al
    ;subtract 30h from it to obtain the rquired number
    add sum,al ; add the entered value with variable sum
    cmp cx,04h
    jne digitf
    mov digit2,al
digitf:
    cmp cx,02h
    jne next
    mov digit4,al
next:  
    mov ah,09h
    lea dx,msg3
    int 21h ; display msg3
    loop up ; loop continues for no.of time mentioned in cx
    lea dx,msg2
    mov ah, 09h
    int 21h    ; display msg2
    mov al,sum ; put the final sum in al
    aam ; apply aam to convert the packed bcd sum to unpacked bcd digits
    ;aam separates the digits and stores it in al and ah
    add ah,30H ; to display any value on screen, the ascii value has to be generated.
    ;Hence add 30h to the value
    add al,30H
    mov dh,al
    mov dl,ah
    mov ah,02h
    int 21h; display the digit1 of sum
    mov dl,dh
    mov ah,02h
    int 21h;display digit2 of sum
    lea dx,msg4
    mov ah,09h
    int 21h ; display msg4
    mov ah,00 ;division is to be performed for ax/bl
    mov al,digit4 ; store digit4 in ax
    mov bl,digit2 ; store digit2 in bl
    div bl ; perform division. quotient will be in AL register
    mov dl,al
    add dl,30h; add 30h to result to get the ascii value of result
    mov ah,02h
    int 21h ; display the result
    mov ah, 4ch ; exit to operating system.
    int 21h  
code ends

end start

OUTPUT:


Related Solutions

Please upload your calculations (e.g., an Excel spreadsheet, a Word document, a PDF file, or a...
Please upload your calculations (e.g., an Excel spreadsheet, a Word document, a PDF file, or a picture of your work) for Q21. Q21. Consider a 2-year bond. The coupon rate of the bond is 10%, and the bond pays coupons semiannually. The bond is selling at a yield to maturity of 8.0% annually, or 4.0% semi-annually. (a) What is the duration of the bond measured in half-years and in years? (10 points) (b) If the semi-annually yield changes from 4.0%...
Assignment Requirements Please complete all parts in a Microsoft Word document. The body of your document...
Assignment Requirements Please complete all parts in a Microsoft Word document. The body of your document should be at least 900 words in length. Quoting should be less than 10% of the entire paper. Paraphrasing is necessary. Students must cite and reference at least 4 credible sources from the Library. Instructions Imagine that you are an administrator for a large hospital. As part of your role within healthcare leadership, you are involved in several committees for the organization. For this...
Please type or submit a PDF document so that I am able to legibly understand the...
Please type or submit a PDF document so that I am able to legibly understand the answer. ( This is ome question 2. In the case study below you will explore the causes of B12 deficiency in three patients. A. Patient A is a college student who has become increasingly tired over the last six months. She thought it was because of her tough schedule but since she noticed tingling in her feet, she thought she should see a doctor....
For Assignment 2, submit a word or pdf file with the SQL queries along with screenshots...
For Assignment 2, submit a word or pdf file with the SQL queries along with screenshots of the outputs. (It is ok if the whole problem cannot be answered, if possible, I just would like an idea of how to begin, thanks in advance!) 9. Write a query to count the number of invoices. 10. Write a query to count the number of customers with a balance of more than $500. 11. Generate a listing of all purchases made by...
For your task, provide responses to the following in a Word document and submit them: project...
For your task, provide responses to the following in a Word document and submit them: project name - Build an IT infrastructure for a medium size company that does accounting Explain why you selected this project Based on your project selection, explain what requirements and restrictions would be encountered Explain how you would go about constructing this project using an engineering approach
Quantitative Reasoning Problem 2 ACC 122 Assignment is to be completed as a Word Document, PDF,...
Quantitative Reasoning Problem 2 ACC 122 Assignment is to be completed as a Word Document, PDF, or on notebook paper and submitted through Moodle The table below contains letters a, b, c, d. 2018 2017 Average common stockholder equity $1,800,000 $1,900,000 Dividends paid to common shareholders 90,000 70,000 Dividends paid to preferred shareholders 20,000 20,000 Net Income 290,000 248,000 Market Price of common stock $20 $25 Weighted average number of shares common stock outstanding 150,000 180,000 Earnings per share (a)...
The Questions (Submit the below in one Word document please): How is a Crime different than...
The Questions (Submit the below in one Word document please): How is a Crime different than a Tort? Compare Intentional Tort and Negligence. What is the relationship between Breach of Duty and Standard of Care? In Strict Liability cases, why does the Defendant try to convince the Court that it is a Negligence case and not a case of Strict Liability? End of Question
Answer the following questions and upload to Canvas. Submit in Word or PDF format.  Show your work...
Answer the following questions and upload to Canvas. Submit in Word or PDF format.  Show your work and upload the Excel sheet as well. All the writing parts must be your original writing, don't quote, write in your own words. The following table presents the orders of Samson Company for the last 36 months (3 years). Month Order Year 1 Order Year 2 Order Year 3 January 502 614 712 February 408 592 698 March 491 584 686 April 456 532...
Review the following scenario, and answer the questions. Create a Word document for your answers, submit...
Review the following scenario, and answer the questions. Create a Word document for your answers, submit via submission link. A 28-year-old primigravida at 41 weeks’ gestation is admitted to the L&D unit for early labor at 2 cm, 70% effaced, and 0 station. How can the nurse best describe to this patient the latent phase of labor? How will the cardinal movements of labor facilitate the birth of the fetus?
Research and develop a MS Word document of at least 2000 words that: 1) Discusses a...
Research and develop a MS Word document of at least 2000 words that: 1) Discusses a renewable/sustainable energy project in the U.S. 2) The paper must include the background/history of the project. Who are the champions of the project? Who are the beneficiaries of the project? Is there an economical impact? Your opinion of the sustainability of the project. 3) State whether you are for or against the the effort and why. 4) Write a one or two paragraph conclusion...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT