🔒 Closed Bartleby Unlock (Solutions)

Status
Not open for further replies.
Step 1
Chemistry homework question answer, step 1, image 1

Step 2
Chemistry homework question answer, step 2, image 1

Step 3
Chemistry homework question answer, step 3, image 1

Was this solution helpful?
 
Step 1 Introduction
The question is based on the concept of Accounting ratios.
Step 2 Calculating the required part
Part (g)
Book value per share = Shareholder,s Equity/ Number of equity shares
Shareholder,s Equity = 600000
Number of equity shares = 300000/100 = 3000 shares
Therefore, Book value per share = 600000/3000 = P200 per share

Part (h)
The ratio of Net Income to Net Sales = Net Income / Net Sales
= 90000 / 1000000 = 0.09 or 9%

Part (i)
Net Earning per share of stock = Net Income / Number of equity shares
= 90000 / 3000 = P30 per share
 
Step 1
Open circuit voltage is the difference in the potential of two terminals of the device when the device is not connected in the circuit.
The connection of the circuits or devices is done in parallel manner for all the house of electrical consumers. It is because if there is fault in one device then it will not affect the power flow in other devices.
The general connections of two loads connected in parallel are shown below:
Electrical Engineering homework question answer, step 1, image 1

Step 2
The above circuit is open circuited due to which no current will flow through it, but the voltage across the open circuit point will be equal to the voltage applied to the circuit that is 120V ac power supply.
By using Kirchhoff’s voltage law, the voltage across the open point can be evaluated as the current flowing through the loads are zero then by Ohm’s law the voltage across them are also 0.
Hence, applying KVL:
Electrical Engineering homework question answer, step 2, image 1

Step 3
The series resistive circuit is drawn below:
Electrical Engineering homework question answer, step 3, image 1

Step 4
Let us consider the value of the resistor is equal then the voltage across them will be one-third of the total voltage that means the voltage is present across the resistor.
In above circuit, the current I is flowing let say one resistor is removed or break then the circuit will be open circuited. The voltage across the broken point or the terminals of that removed resistor will be present.
Redrawing the circuit by removing one resistor as shown below:
Electrical Engineering homework question answer, step 4, image 1

Step 5
Since, the circuit is open circuited then the current flowing through the resistor or current in the circuit will be 0 and the voltage across both the resistor will be 0.
Now, using the KVL the voltage across the open terminal will be:
Electrical Engineering homework question answer, step 5, image 1
 
Step 1: Algorithm
if(choice == "a"):
if (len(reservation) == 0):
print("There are no reservations!!")
else:
print("#Date\t\t\tTime\t\tName\tAdults\tChildren")
for item in reservation:
list = reservation.get(item)
for i in list[:-1]:
print(f"{i}", end="\t\t")
print("\n")
elif(choice =="b"):
try:
rnum += 1
name = input("Enter Name: ")
Date = input("Enter date(DD-MM-YYYY): ")
Time = input("Enter time(HH:MM): ")
adults = int(input("Number of adults: "))
Children = int(input("Number os children: "))
total = adults*500 + Children*300
reservation[rnum]= [Date,Time,name,adults,Children,total]

print("\nBelow are your Reservation Details:")
print(f"Reservation Number\t\t{rnum}\nName\t\t{name}\nDate\t\t{Date}\nTime\t\t{Time}\nTotal Adults\t\t{adults}\nTotal children\t\t{Children}\n")
print(reservation)

except ValueError:
print("there is an incorrect value!! try again")


elif(choice == "c"):
getindex = 0;
rnumd = int(input("Enter Reservation number:"))
try:
reservation.pop(rnumd)
except KeyError:
print("Invalid reservation ID")

print("Reservation deleted")

elif(choice == "d"):
print("#Date\t\t\tTime\t\tName\tAdults\tChildren\tSubtotal")
for item in reservation:
for i in reservation.get(item):
print(f"{i}",end="\t")
print("\n")
elif(choice == "e"):
break
Step 2: code

reservation = {}
rnum = 0

while True:
mylist= []
choice = input('\nRESTAURANT RESERVATION SYSTEM\nSystem Menu\na. View all Reservationsn\nb. Make Reservation\nc. Delete Reservation\nd. Generate Report\ne. Exit\nEnter choice --> ').lower()
if(choice == "a"):
if (len(reservation) == 0):
print("There are no reservations!!")
else:
print("#Date\t\t\tTime\t\tName\tAdults\tChildren")
for item in reservation:
list = reservation.get(item)
for i in list[:-1]:
print(f"{i}", end="\t\t")
print("\n")
elif(choice =="b"):
try:
rnum += 1
name = input("Enter Name: ")
Date = input("Enter date(DD-MM-YYYY): ")
Time = input("Enter time(HH:MM): ")
adults = int(input("Number of adults: "))
Children = int(input("Number os children: "))
total = adults*500 + Children*300
reservation[rnum]= [Date,Time,name,adults,Children,total]

print("\nBelow are your Reservation Details:")
print(f"Reservation Number\t\t{rnum}\nName\t\t{name}\nDate\t\t{Date}\nTime\t\t{Time}\nTotal Adults\t\t{adults}\nTotal children\t\t{Children}\n")
print(reservation)

except ValueError:
print("there is an incorrect value!! try again")


elif(choice == "c"):
getindex = 0;
rnumd = int(input("Enter Reservation number:"))
try:
reservation.pop(rnumd)
except KeyError:
print("Invalid reservation ID")

print("Reservation deleted")

elif(choice == "d"):
print("#Date\t\t\tTime\t\tName\tAdults\tChildren\tSubtotal")
for item in reservation:
for i in reservation.get(item):
print(f"{i}",end="\t")
print("\n")
elif(choice == "e"):
break
Step 3
Computer Engineering homework question answer, step 3, image 1

Step 4
Computer Engineering homework question answer, step 4, image 1
 
Step 1 Introduction to python program
It is defined as a powerful general-purpose programming language. It is used in web development, data science, creating software prototypes, and so on.
Step 2 Solution
from collections import namedtuple
import datetime
Reservation = namedtuple('Reservation','room arr_date dept_date guest_name confirmation_num')
#----------global variables / lists----------#
confirmation_counter = 0
bedroom_list = []
reservation_list = []
#main function
def Anteater_BandB (file_name:str)-> None:
'''main function. reads a file named file_name'''
infile = open(file_name, 'r')
data = infile.readlines()
infile.close()
for line in data:
line = line.strip()
line_reader(line)
def line_reader(l: str) -> None:
'''takes in one line of input and calls appropriate functions'''
command = l[:2].upper()
rest_of_input = l[2:].strip()
if command == '**':
pass;
elif command == 'AB':
add_bedroom(rest_of_input)
elif command == 'BL':
display_bedroom_list()
elif command == 'PL':
print_line(rest_of_input)
elif command == 'BD':
delete_bedroom(rest_of_input)
elif command == 'NR':
new_reservation(rest_of_input)
elif command == 'RL':
display_reservation_list()
elif command == 'RD':
delete_reservation(rest_of_input)
elif command == 'RB':
reservations_by_bedroom(rest_of_input)
elif command == 'RC':
reservations_by_guest(rest_of_input)
elif command == 'LA':
list_arrivals(rest_of_input)
elif command == 'LD':
list_departures(rest_of_input)
elif command =='LF':
list_free_beds(rest_of_input)
elif command == 'LO':
list_occupied(rest_of_input)
def dashes():
return '------------------------------------'
#AB
def add_bedroom(room: str)-> None:
'''takes in a room number as a string and puts it into bedroom_list'''
global bedroom_list
if room in bedroom_list:
print('The bedroom is already in the list.')
else:
bedroom_list.append(room)
#BL
def display_bedroom_list():
'''prints items in bedroom_list'''
global bedroom_list
print('Number of bedrooms in service:\t', len(bedroom_list))
print(dashes())
for bed in bedroom_list:
print(bed)
#PL
def print_line(r: str):
print(r)
#BD
def delete_bedroom(room:str)-> None:
'''deletes specified room from the list. print error message if
room isn't on the list'''
global bedroom_list
if room in bedroom_list:
bedroom_list.remove(room)
cancel_room_reservations(room)
else:
print('Sorry, can\'t delete room '+room+'; it is not in service now')

def compare_date(date1:str,date2:str)->bool:
'''compares two dates. returns true if date 2 is after date 1'''
date1 = date1.split('/')
date_1 = datetime.date(int(date1[2]),int(date1[0]),int(date1[1]))
date2 = date2.split('/')
date_2 = datetime.date(int(date2[2]),int(date2[0]),int(date2[1]))
if date_2>date_1:
return True
else:
return False
def date(date:str)->int:
date = date.split('/')
result = datetime.date(int(date[2]),int(date[0]),int(date[1]))
return result
def conf_num(r: Reservation) -> int:
return r.confirmation_num
#NR
def new_reservation(rest_input: str)->None:
'''creates a new reservation namedtuple and adds it to reservation_list'''
global reservation_list
global bedroom_list
global confirmation_counter
#chop up input to get variables
parts = rest_input.split()
room_request = parts[0]
arrival = parts[1]
departure = parts[2]
name = ''
for item in parts[3:]:
name+=item
name+=' '
if (room_request in bedroom_list) and (allow_reservation(arrival, departure)) and room_not_taken(room_request) :
confirmation_counter+=1
reservation = Reservation(room_request, arrival, departure, name, confirmation_counter)
reservation_list.append(reservation)
print('Reserving room '+room_request+' for '+name+' -- Confirmation # ' + str(confirmation_counter))
print('(arriving ' + arrival + ', departing ' + departure + ' )')
elif allow_reservation(arrival, departure) == False:
print("Sorry, can't reserve room ",room_request,'(',arrival,' to ',departure,"); \n can't leave before you arrive.")
elif room_not_taken(room_request)==False:
print("Sorry, can't reserve room ",room_request,'(',arrival,' to ',departure,"); \n it is already booked (conf # ",str(confirmation_counter))
else:
print("Sorry, can't reserve room", room_request,'; room not in service')


#RL
def display_reservation_list():
global reservation_list
print('Number of reservations:\t' + str(len(reservation_list)))
print('{:>3}{:>4}{:>11}{:>11}{}{}'.format('No.','Rm.','Arrive','Depart',' ','Guest'))
print(dashes())
for r in reservation_list:
print('{:>3}{:>4}{:>11}{:>11}{}{}'.format(
str(r.confirmation_num),r.room,r.arr_date,r.dept_date,' ',r.guest_name))
#RD
def delete_reservation(num: str):
'''takes in a confirmation number and deletes the reservation with that confirmation number'''
global reservation_list
#reservation_list.sort(key = conf_num, reverse=False)
confirmation_list = []
for r in reservation_list:
confirmation_list.append(r.confirmation_num)
if (int(num) in confirmation_list):
reservation_index = confirmation_list.index(int(num)) #find where the reservation is in the list
reservation_list.remove(reservation_list[reservation_index]) #delete the reservation with that index
else:
print("Sorry, can't cancel reservation; no confirmation number " + num)

#First: reject if arrival of guest A is later than departure date of guest A
def allow_reservation(arr: str, dept: str)-> bool:
'''takes in two dates as strings, converts them to dates to compare them,
and determines whether, based on the arr and dept date, the reservation is valid
'''
if date(arr)>=date(dept):
#print('can\'t leave before you arrive')
return False
return True
#Second: check conflicts with existing reservations
def room_not_taken(room_req: str) -> bool:
'''return true if room is taken'''
#based on whether bedroom is free
global reservation_list
reserved_rooms = []
for r in reservation_list:
reserved_rooms.append(r.room) #list of strings of taken rooms
if (room_req not in reserved_rooms):
return True
return False
def reservations_conflict(r1:Reservation, r2:Reservation)-> bool:
'''takes two reservations and compares them. return true if they conflict'''
if (date(r1.arr_date)>=date(r2.arr_date) and date(r1.arr_date)<date(r2.dept_date)) or (date(r1.dept_date)>=date(r2.arr_date) and date(r1.dept_date)<date(r2.dept_date)):
print('Sorry, can\'t reserve room '+room_request+'\t('+arrival+' to '+departure+');')
print('it\'s already been booked')
return True
return False
#Finally, if user deletes bedroom, all reservations for that room are cancelled
def cancel_room_reservations(room:str):
for r in reservation_list:
if r.room == room:
print('Deleting room',room,'forces cancellation of this reservation:')
print('\t',r.guest_name,'arriving',r.arr_date,'and departing',r.dept_date,'(Conf. #',r.confirmation_num,')')
delete_reservation(r.confirmation_num)

#RB
def reservations_by_bedroom(line:str):
global reservation_list
bedroom_reserve_list= []
bedroom_num = line
for r in reservation_list:
if r.room == bedroom_num:
bedroom_reserve_list.append(r)
print("Reservations for room " + line +':')
for re in bedroom_reserve_list:
print(re.arr_date,' to ',re.dept_date, re.guest_name)
#RC
def reservations_by_guest(line:str):
guest_reserve_list = []
guest_name = line
print('Reservation for',guest_name)
for r in reservation_list:
if r.guest_name == guest_name:
print(r.arr_date + ' to ' + r.dept_date + ': room ' + r.room)
def display_guest(rl:list) -> None:
'''takes in a reservation list and prints out guest name as well as room number
'''
for r in rl:
print(r.guest_name+ '(room '+ r.room + ')')
def reserved_rooms(rl: list) -> list:
'''takes in a list of reservations and returns a list of reserved rooms'''
reserved = []
for r in rl:
reserved.append(str(r.room))
return reserved
#LA
def list_arrivals(line:str):
guest_arrival_list = []
guest_arrival = date(line)
for r in reservation_list:
if guest_arrival == date(r.arr_date):
guest_arrival_list.append(r)
print('Guests arriving on '+ line+ ':')
display_guest(guest_arrival_list)
#LD
def list_departures(line:str):
guest_departure_list = []
guest_departure = date(line)
for r in reservation_list:
if guest_departure == date(r.dept_date):
guest_departure_list.append(r)
print('Guests departing on '+ line+ ':')
display_guest(guest_departure_list)
#LF
def list_free_beds(line:str):
global bedroom_list
bedroom_requests = []
two_dates = line.split()
arr_date = two_dates[0]
dept_date = two_dates[1]
print('Bedrooms free between ' + arr_date + ' to ' + dept_date + ':')
for r in reservation_list:
if (date(dept_date)<=date(r.arr_date)) or (date(arr_date)>=date(r.dept_date)):
bedroom_requests.append(str(r.room))
for b in bedroom_list:
if str(b) not in reserved_rooms(reservation_list):
bedroom_requests.append(str(b))
bedroom_requests = list(set(bedroom_requests))
for beds in bedroom_requests:
print(beds)
#LO
def list_occupied(line:str):
global bedroom_list
bedroom_requests = []
two_dates = line[2:].split()
arr_date = two_dates[0]
dept_date = two_dates[1]
print('Bedrooms occupied between ' + arr_date + ' to ' + dept_date + ':')
for r in reservation_list:
if not (date(dept_date)<=date(r.arr_date)) or (date(arr_date)>=date(r.dept_date)):
bedroom_requests.append(str(r.room))
bedroom_requests = list(set(bedroom_requests))
for beds in bedroom_requests:
print(beds)
 
Status
Not open for further replies.

About this Thread

  • 134
    Replies
  • 731
    Views
  • 20
    Participants
Last reply from:
papay1234

Trending Topics

Online now

Members online
1,159
Guests online
19,151
Total visitors
20,310

Forum statistics

Threads
2,289,156
Posts
29,056,658
Members
1,213,574
Latest member
mido_many2000
Back
Top