Course Solutions Uncategorized (Solved) : Convert Following Python Code Java Code Print Header Forwarding Database Fdb Def Printhead Q32729713 . . . .

(Solved) : Convert Following Python Code Java Code Print Header Forwarding Database Fdb Def Printhead Q32729713 . . . .

 

Convert the following python code into javacode

# print header for forwarding database(FDB)
def printHeader(outFile: str):
outFile.write(“————————————————-n”)
outFile.write(“| Indx | Host | Port |n”)
outFile.write(“————————————————-n”)

# print forwarding database(FDB)
def printFDB(outFile: str, fdb: dict):
index = 1
printHeader(outFile)
for port, src_mac in fdb.items():
………………outFile.write(“|{0}|{1}|{2}|n”.format(index,src_mac, port))
………………index += 1
outFile.write(“n”)

# number of ports in the bridge
number_of_ports = int(input(“Number of ports in the bridge:”))
if number_of_ports > 8:
……………print(“Number of ports should be less than 9”)
……………exit()

fileName = input(“Enter input file name: “)

fdb = {} # empty dictionary to store MAC and its incoming portnumber

with open(“fdb.txt”, ‘w’) as outFile:

………….with open(“inp.txt”, ‘r’) as file:
………………………frames = file.readlines() # The variable”frames” is a list containing all lines in the file
………………………for frame

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : Following Program Creates Binary Search Tree Alternatingordertxt File Converts Bst Double Q30610901 . . . .(Solved) : Following Program Creates Binary Search Tree Alternatingordertxt File Converts Bst Double Q30610901 . . . .

<p><strong>The following program creates a Binary search tree fromthe</strong> <strong>alternating_order.txt</strong> <strong>file.Then it converts the BST into a double linked list. How canI</strong> I<strong>mplement a second find/searchmethod which uses the ordered