4. Create a class named HotelRoom that includes an integer field for the room number and a double field for the nightly rental rate. The constructor of this class requires an integer argument representing the room number and the constructor sets the room rate based on the room number; rooms numbered 299 and below are $69.95 per night, and others are $89.95 per night. Create an extended class named Suite whose constructor requires a room number and adds a $40 surcharge to the regular hotel room rate, which again is based on the room number. Write an application named UseHotelRoom that creates an object of each class, accept room number from user, demonstrate that all the methods work correctly and display the details. Save the files as UseHotelRoom.java.
Suppose a system has not implemented any deadlock prevention and avoidances measurement. Therefore, it has to run the deadlock detection algorithm in case deadlock has occurred in a system. Following two strategies can be adopted to recover the system from a deadlock.
In your opinion, which option will be considered more suitable to recover the system from a deadlock? Write a concise and to the point answer with valid reasons.
please see the output and correct the code :--
Input:---
4 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Output :--
1 2 3 4 5 6 7 8 9 10 11 12 16 15 14 13
Input 2:---
3 4
1 2 3 4
10 11 12 5
9 8 7 6
Output 2:--
1 2 3 4 5 12 11 10 9 8 7 6
def read_matrix():
line = input()
words =line.split()
n = int(words[0])
m = int(words[1])
mat = []
for i in range(n):
row = []
line = input()
words = line.split()
for j in range(m):
row.append(int(words[j]))
mat.append(row)
return mat
def print_zig_zag(mat):
for i in mat:
for j in i:
print(j,end=" ")
print_zig_zag(read_matrix())
A = int(input())
B = int(input())
for num in range(A, B + 1):
# order of number
order = len(str(num))
# initialize sum
sum = 0
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** order
temp //= 10
if num == sum:
print(num)In this python program it has two test cases, in this two test cases one test case was getting expected output and second test case are not getting expected output. Please give me expexted output for two test cases. Thank you !
Hints:
Sample Input 1
150
200
Sample Output 1
153
Sample Input 2
1
3
Sample Output 2
1 2 3
Product of the Given Numbers
Given an integer using WHILE LOOP
The first line of input is a positive integer,
The output should be the product of the given input integers.
In the given example,
N = 3 and the input integers are 2, 3, and 7.So, the output should be 2 x 3 x 7 = 42
The first line of input is an integer
In the example, the given starting number is
10, and the number of rows in the pyramid is 5.So, the output should be
10
11 12
13 14 15
16 17 18 19
20 21 22 23 24
Diamond Crystal
This Program name is Diamond Crystal. Write a Python program to Diamond Crystal, it has two test cases
The below link contains Diamond Crystal question, explanation and test cases
https://docs.google.com/document/d/1sVH8M0vCCSky84V1PkWD-eKm1v0dPRC5/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true
We need exact output when the code was run
Maximum
This Program name is Maximum. Write a Python program to Maximum, it has two test cases
The below link contains Maximum question, explanation and test cases
https://docs.google.com/document/d/1z0yr9wfjkiTADlYer1IJgNn2w8x3_HJG/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true
We need exact output when the code was run
Hyphenate Letters
This Program name is Hyphenate Letters. Write a Python program to Hyphenate Letters, it has two test cases
The below link contains Hyphenate Letters question, explanation and test cases
https://docs.google.com/document/d/1IrqSpmObeTn85U5gmkMV7IEwgDVYmfvg/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true
We need exact output when the code was run