(+10 ) Problem #14 in the Chapter review problems on Page 199 Answer a provided
ID: 3902490 • Letter: #
Question
(+10 ) Problem #14 in the Chapter review problems on Page 199
Answer a provided
a. 5.18.35
b.
c.
(+10 ) Problem #15 in the Chapter review problems on Page 199
Answer c provided
a.
b.
c. 0000 1000 0000 1100 0001 0100 0000 1101
(+10 ) Convert the following two’s complement representations to its equivalent base 10 value. Recall if the most significant bit is a 1 the number is negative
1101110 _______
0110110 ________
(+5 ) The entire URL required to retrieve the Web document named bulldogs.html from the Webserver at animals.org assuming that the document is stored in the directory named dogs:
a. https://animals.org/dogs/bulldogs.html
b. http://animals.org/dogs/bulldogs.html
c. http://dogs.animals.org/bulldogs.html
d. http://animals.org/dogs.bulldogs.html
(+5 ) Can the following 2’s complement calculation be performed using 6 bits?
32 - 31
a. Yes the result is 000001
b. No, -31 cannot be expressed using 6 bits
c. No 32 cannot be expressed using 6 bits
d. Yes the result is 000011
(+5 ) Can the following 2’s complement calculation be performed using 4 bits?
-8 + 7
a. Yes the result is 1111
b. Yes, the result is 0001
c. No -8 cannot be expressed using 4 bits
d. No 7 cannot be expressed using 4 bits
---
(+20) Provide a python program to determine the parking fees at the airport based on the following time constraints :
Any amount of time less than or equal to one hour, the parking fee is 5.00. This means if your parked for 5, 15, 55 or 60 minutes you pay $5.00
Minutes parked
Hrs*Fee=parking fee
25 minutes (0 hour and 25 minutes)
1*5.00
05 minutes (0 hour and 5 minutes)
1*5.00
55 minutes (0 hours and 55 minutes)
1*5.00
30 minutes (0 hour and 30 minutes)
1*5.00
10 minutes (0 hour and 10 minutes)
1*5.00
60 minutes (1 hour and 0 minutes)
1*5.00
Any amount of time greater than one hour but less than or equal to 5 hours (300 minutes), the parking fee is 4.00 per hour and any fraction thereof. This means:
Minutes parked
Hrs*Fee=parking fee
65 minutes (1 hour and 5 minutes)
2*4.00
95 minutes (1 hour and 35 minutes)
2*4.00
120 minutes (2 hours)
2*4.00
135 minutes (2 hour and 15 minutes)
3*4.00
180 minutes (3 hour and 0 minutes)
3*4.00
195 minutes (3 hour and 15 minutes)
4*4.00
240 minutes (4 hours)
4*4.00
260 minutes (4 hours 20 minutes )
5*4.00
300 minutes (5 hours)
5*4.00
Any amount of time greater than 5 hours, the parking fee is 2.00 per hour and any fraction.
Minutes parked
Hrs*Fee = parking fee
320 minutes (5 hour and 20 minutes)
6*2.00
400 minutes (6 hour and 40 minutes)
7*2.00
800 minutes (13 hour and 20 minutes)
14*2.00
825 minutes (13 hour and 45 minutes)
14*2.00
600 minutes (10 hours)
10*2.00
Use the following test cases to make sure the results of your code are as expected
Minutes parked Cost
1 x ==25.3
2 x1 ==25.35
3 y ==24
4 Z ==54
5 a ==0.55
6 b ==0
Please enter number of minutes parked...
we are in table 2 fee is0.0
:
: minutes parked
: Parking fee
Your program should ask the user for minutes parked, use the various functions/operators as needed to determine in which table 1, 2 3 the minutes falls into, compute and output the parking fee
Let m = minutes parked
fee = parking fee
Please make sure your code uses the constants:rate1 rate2 rate3
Once you have determined your algorithm, try it for several of the minute examples provided in the tables above for accuracy
Minutes parked
Hrs*Fee=parking fee
25 minutes (0 hour and 25 minutes)
1*5.00
05 minutes (0 hour and 5 minutes)
1*5.00
55 minutes (0 hours and 55 minutes)
1*5.00
30 minutes (0 hour and 30 minutes)
1*5.00
10 minutes (0 hour and 10 minutes)
1*5.00
60 minutes (1 hour and 0 minutes)
1*5.00
Explanation / Answer
We are required to do only 4 parts of a question
Two's complement
1101110 - Negative number has a leading ‘1’ bit and can be converted to decimal by converting the whole number to decimal and then subtracting 2^numBits.
Here we have 7 bits
1101110 = 110
2^7=128
Answer = 110-128 = - 18.
0110110
Nonnegative number has a leading ‘0’ bit and Simply be converted to decimal.
0110110 = 54.
The URL will be a. https://animals.org/dogs/bulldogs.html
The correct option will be c. No 32 cannot be expressed using 6 bits because 7 bits are needed to find the two's complement of 32.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.