978-0128012420 Chapter 9 Part 2

subject Type Homework Help
subject Pages 9
subject Words 976
subject Authors George Wise, Philip Kosky, Robert T. Balmer, William D. Keat

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
9-16. Do the following binary additions. Check your answer by converting each binary
number into decimal. Partial A:
Binary
Decimal
Binary
Decimal
Binary
Decimal
1010
10
11101
10111
+110
6
+10011
+ 10
10000
16
Need: a) 1010 + 110 = _____, _____ b) 11101 + 10011 = _____, _____;
c) 10111 + 10 = _____, _____ (each answer a sequence of 1s and 0s) and
a decimal equivalent.
page-pf2
9.17 Do the following binary subtractions. Check your answer by converting each binary
number into decimal. Partial A:
Binary
Decimal
Binary
Decimal
Binary
Decimal
1010
10
11101
10000
-110
-6
-10011
-1
0100
4
Need: a) 1010 - 110 = _____, _____ ; b) 11101 - 10011 = _____, _____;
c) 10111 - 10 = _____, _____ and d) 100 1010 = ______, ______ (each
answer a sequence of 1s and 0s) and a decimal equivalent.
page-pf3
9-18. If a powerful race car has an (A/F)Mass of 12.0 (kg air)/(kg fuel), and the air intake
draws in 1.000 kg of air per second, how much fuel must be injected every second? Solve
in binary to three significant binary digits. (A: 0.000101 kg)
Need: Fuel = ____? kg. where ? is a binary number.
Know: F = 1.000/12 (in decimal) = 1.000/1100 (in binary)
page-pf4
9-19. Suppose we want to devise a binary code to represent the fuel levels in a car:
a) If we need only to describe the possible levels (empty, ¼ full, ½ full, ¾
full, full) how many bits are needed?
b) Give one possible binary code that describes the levels in a)
c) If we need to describe the levels (empty, 1/8 full, ¼ full, 3/8 full, ½ full,
5/8 full, ¾ full, 7/8 full, & full ) how many bits would be needed?
d) If we used an 8-bit code, how many levels could we represent?
Need: a) Number of bits = ____ (a decimal number); b) one possible
binary code; c) Number of bits = ____ (a decimal number); d) For an 8 bit
code, how many levels represented?
page-pf5
9-20. Construct a spreadsheet2 that converts binary numbers from 0 to 111 to decimal
numbers, print as formulae using the “control tilde” command. Check your spreadsheet
against problem 12a. (A: e.g., binary 110 ≡ 1 × 22 + 1 × 21 + 0 20 = decimal 6).
Need: Spreadsheet for binary to decimal conversion
Know: Format of binary numbers.
2 Spreadsheets have some built-in functions for decimal conversions to and from binary. It is
recommended that you try first to use the actual mathematical functions described in this chapter and then
check your answers using these functions to confirm your answers.
page-pf6
9-21. Construct a spreadsheet that converts decimal number 53 to binary. Print as
formulae using the “control tilde” command. Check your spreadsheet against Exercise
9.15. (Hint: 5 (decimal) can be divided by 22 to yield an integer “1” and remainder
1; 1 can’t be divided by 21 (therefore, integer “0”) and “1” can be divided by 20 for
last integer “1.” Check for a spreadsheet function that will divide two numbers and
display their result with no remainder. )
Need: Spreadsheet for decimal to binary conversion for 53 (decimal)
page-pf7
Kosky, Wise, Balmer, Keat: Exploring Engineering, Fourth Edition
8
9
10
11
12
13
14
15
B C D E F G H
Binary =====> Decimal
2^4 2^3 2^2 2^1 2^0
original 0 1 0 1 0 10
takeaway 00 1 1 0 6
borrow
left
0 0 1 0 0 4
borrow
right
0 1 0 0 0 8
answer 0 0 1 0 0 4
Decimal
equiv
to answer 4
8
9
10
11
12
13
14
A B C D
binary
2^4 2^3 2^2
original 0 1 0
takeaway 0 0 1
borrow left =IF((B10-B13)<B11,1,0) =IF((C10-C13)<C11,1,0) =IF((D10-D13)<D11,1,0)
borrow right =C12 =D12 =E12
=B10-B11+2*B12-B13 =C10-C11+2*C12-C13 =D10-D11+2*D12-D13
8
9
10
11
12
13
14
E F G
decimal
2^1 2^0
1 0 =F10+2*E10+4*D10+8*C10+16*B10
1 0 =F11+2*E11+4*D11+8*C11+16*B11
=IF((E10-E13)<E11,1,0) =IF(F10<F11,1,0) =F12+2*E12+4*D12+8*C12+16*B12
=F12 0 =F13+2*E13+4*D13+8*C13+16*B13
=E10-E11+2*E12-E13 =F10-F11+2*F12-F13 =F14+2*E14+4*D14+8*C14+16*B14
page-pf8
9-22. Construct a spreadsheet that does binary subtraction with one’s complement. Test it
on Exercise 9-17.
8
9
10
11
12
13
14
15
B C D E F G H
Binary =====> Decimal
2^4 2^3 2^2 2^1 2^0
original 0 1 0 1 0 10
takeaway 00 1 1 0 6
borrow
left
0 0 1 0 0 4
borrow
right
0 1 0 0 0 8
answer 0 0 1 0 0 4
Decimal
equiv
to answer 4
8
9
10
11
12
13
14
A B C D
binary
2^4 2^3 2^2
original 0 1 0
takeaway 0 0 1
borrow left =IF((B10-B13)<B11,1,0) =IF((C10-C13)<C11,1,0) =IF((D10-D13)<D11,1,0)
borrow right =C12 =D12 =E12
=B10-B11+2*B12-B13 =C10-C11+2*C12-C13 =D10-D11+2*D12-D13
8
9
10
11
12
13
14
E F G
decimal
2^1 2^0
1 0 =F10+2*E10+4*D10+8*C10+16*B10
1 0 =F11+2*E11+4*D11+8*C11+16*B11
=IF((E10-E13)<E11,1,0) =IF(F10<F11,1,0) =F12+2*E12+4*D12+8*C12+16*B12
=F12 0 =F13+2*E13+4*D13+8*C13+16*B13
=E10-E11+2*E12-E13 =F10-F11+2*F12-F13 =F14+2*E14+4*D14+8*C14+16*B14
page-pf9
9-23. In the game "Rock, Scissors, Paper" we have the following rules:
Rock breaks Scissors
Scissors cuts Paper
Paper covers Rock
If we were to create a code to represent the 3 entities, Rock, Scissors and Paper, we
would need two bits. Suppose we have the following code, where we call the first bit X
and the second bit Y:
X
Y
Rock:
0
0
Scissors:
0
1
Paper:
1
0
Now if we have two players who can each choose one of these codes, we can play the
game.
Examples:
Player 1
Rock (0 0)
Player 2
Scissors (01)
Player 1 wins
Player 1
Scissors (01)
Player 2
Scissors (01)
Tie
Player 1
Paper (10)
Player 2
Rock (0 0)
Player 2 wins
We see that there are three possible outcomes of the game: Player 1 wins, Tie, Player 2
wins.
Complete the table below that describes all the possible outcomes of the game.
Player 1
X, Y
Player 2
X, Y
Player 1 wins
Tie
Player 2 wins
0 0
00
0
1
0
0 0
0 1
1
0
0
0 0
1 0
0
0
1
0 1
0 0
0
0
1
01
0 1
0
1
0
01
10
1
0
0
1 0
0 0
1
0
0
1 0
0 1
0
0
1
1 0
1 0
0
1
0
Totals
3
3
3
page-pfa
Copyright ©2015, Elsevier, Inc
1. Thou shalt not use a computer to harm other people.
3. Thou shalt not snoop around in other people's computer files.
5. Thou shalt not use a computer to bear false witness.
7. Thou shalt not use other people's computer resources without authorization or proper
compensation.
9. Thou shalt think about the social consequences of the program you are writing or the system you
are designing.
10. Thou shalt always use a computer in ways that ensure consideration and respect for your fellow
page-pfb
Copyright ©2015, Elsevier, Inc
9-24. A company purchased a computer program for your part time job with them. The
license agreement states that you can make a backup copy, but you can only use the
program on one computer at a time. Since you have permission to make a backup copy,
why not make copies for friends? What do you do?
a) Go ahead, since your friends only use one computer at a time and these are
backup copies.
b) Make the backup copy, but sharing it with anyone clearly violates the license
agreement.
c) Ask your supervisor if you can use the backup copy at home, then make as many
copies as you wish.
d) Use the program discretely, since software license agreements can’t be enforced
anyway.
Use an Engineering Ethics Matrix to reach your conclusions.
1) Apply the Fundamental Canons: Engineers, in the fulfillment of their professional
duties, shall:
page-pfc
2) Engineering Ethics Matrix:
Options
Canons
a) Go ahead
b) Make but
don’t share
c) Ask and
copy
d) Use
discreetly
Hold
paramount the
safety, health
and welfare of
the public.
Does not
apply
Does not
apply
Does not
apply
Does not
apply
Perform
services only
in the area of
your
competence
Does not
apply
Does not
apply
Does not
apply
Does not
apply
Issue public
statements
only in an
objective and
truthful
manner
Does not
apply
Does not
apply
Does not
apply
Does not
apply
Act for each
employer or
client as
faithful agents
or trustees
Endangers
employer
Does not
apply
Endangers
employer
Endangers
employer
Avoid
deceptive acts
Does not
apply
Does not
apply
This is
deceptive
Does not
apply
Conduct
themselves
honorably
Dishonorable
as well as
unlawful
Does not
apply
Dishonorable
as well as
unlawful
Dishonorable
as well as
unlawful
Solution: The canons rule out all but option b). Check yourself how this
situation is covered by the commandments of the Computer Ethics
Institute.
page-pfd
9-25. You are a software engineer at a small company. You have written a software
program that will be used by a major manufacturer in a popular product line. Your
supervisor asks you to install a “back door” into the program that no one will know about
so that he can monitor its use by the public. What do you do?
1) Fundamental Canons: Engineers, in the fulfillment of their professional duties, shall:
page-pfe
2) Summarize with the Engineering Ethics Matrix:
Options
Canons
a) Install
b) Don’t do
without
authorization
c) Install, then
deactivate
d) Stall and
look for
another job
Hold
paramount the
safety, health
and welfare of
the public.
Does not
apply
Does not
apply
Does not
apply
Does not
apply
Perform
services only
in the area of
your
competence
Does not
apply
Does not
apply
Does not
apply
Does not
apply
Issue public
statements
only in an
objective and
truthful
manner
Does not
apply
Meets canon
This is
deceptive
This is
deceptive
Act for each
employer or
client as
faithful agents
or trustees
Obeying
superficially
meets this
canon, but
actually
exposes
employer to
prosecution
Meets canon
Not acting
like a faithful
agent
Not acting
like a faithful
agent
Avoid
deceptive acts
Does not
apply
Meets canon
This is
deceptive
This is
deceptive
Conduct
themselves
honorably
Dishonorable
as well as
unlawful
Meets canon
Dishonorable
though not
unlawful
Dishonorable
though not
unlawful
Solution: Do b).

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.