1. Write a program that will read two values, a and b, and will print the quantity a+b and then loop to read another pair of values. a-b’ 2. Write a program that will read three values, a, b, and c, and compute a a* and b*c

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

Help with my homework. Thank you so much.

Table A.2 Code for computing la - b|
Exercises
Symbolic code
Machine code
1. Although we have not yet described division in our miniature computer, let us
assume that a quotient p÷ q (the integral part) may be obtained by the code
sequence that corresponds to
Instruction
Addresst
Instruction
Address
name
Start
CLA P
START
RDS A
09
701
DIV Q
RDS B
10
702
CLA A
11
101
The resulting quotient will be found in the three lowest-order positions of the
АСС.
Write a sequence of symbolic codes and corresponding machine codes that
will compute the value
SUB B
STO C
TMI NEG
PRT C
TRA START
302
403
017
803
909
102
301
403
915
12
13
14
AGAIN
15
16
а — b,
y =
a+ b,
CLA B
SUB A
NEG
17
18
b.
Draw a picture of the storage cells showing all instructions and locations for
original or intermediate results. You must make certain decisions, such as where
STO C
19
TRA AGAIN
20
to keep a, b, and y in storage and at what location to begin the program.
Hint: Before the division can be carried out, both the numerator and the
denominator must be computed. At least one of these must be saved, in a place
that you will have to designate, while the other is being computed.
t We are assuming the following: (1) Instructions begin at 09.
(2) A at 01, B at 02, C at 03.
eea-b
2. After completing Exercise 1, write a sequence of instructions that reads a pair of
values for a and b from punch cards, computes y, prints it, and returns to read
another pair of values.
T.
e<0
3. Assume that a product p X q may be obtained by the code sequence that cor-
responds to
Negative
CLA P
MPY Q
Write a code sequence to compute the following.
Ceb-a
a) d=ªXb
a
b) c=
bx c
Print
Fig. A.10 Flowchart for computing a- b|.
Transcribed Image Text:Table A.2 Code for computing la - b| Exercises Symbolic code Machine code 1. Although we have not yet described division in our miniature computer, let us assume that a quotient p÷ q (the integral part) may be obtained by the code sequence that corresponds to Instruction Addresst Instruction Address name Start CLA P START RDS A 09 701 DIV Q RDS B 10 702 CLA A 11 101 The resulting quotient will be found in the three lowest-order positions of the АСС. Write a sequence of symbolic codes and corresponding machine codes that will compute the value SUB B STO C TMI NEG PRT C TRA START 302 403 017 803 909 102 301 403 915 12 13 14 AGAIN 15 16 а — b, y = a+ b, CLA B SUB A NEG 17 18 b. Draw a picture of the storage cells showing all instructions and locations for original or intermediate results. You must make certain decisions, such as where STO C 19 TRA AGAIN 20 to keep a, b, and y in storage and at what location to begin the program. Hint: Before the division can be carried out, both the numerator and the denominator must be computed. At least one of these must be saved, in a place that you will have to designate, while the other is being computed. t We are assuming the following: (1) Instructions begin at 09. (2) A at 01, B at 02, C at 03. eea-b 2. After completing Exercise 1, write a sequence of instructions that reads a pair of values for a and b from punch cards, computes y, prints it, and returns to read another pair of values. T. e<0 3. Assume that a product p X q may be obtained by the code sequence that cor- responds to Negative CLA P MPY Q Write a code sequence to compute the following. Ceb-a a) d=ªXb a b) c= bx c Print Fig. A.10 Flowchart for computing a- b|.
Exercises:
1. Write a program that will read two values, a and b, and will print the quantity
a+b
and then loop to read another pair of values.
a-b
2. Write a program that will read three values, a, b, and c, and compute
a*b
and
a
b*c'
3. Write a program that will read a number and print its absolute value.
In all three of the above programs, write the assembly code first, then write the machine code, then place the code into computer memory.
Transcribed Image Text:Exercises: 1. Write a program that will read two values, a and b, and will print the quantity a+b and then loop to read another pair of values. a-b 2. Write a program that will read three values, a, b, and c, and compute a*b and a b*c' 3. Write a program that will read a number and print its absolute value. In all three of the above programs, write the assembly code first, then write the machine code, then place the code into computer memory.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education