You will need to extract the sample CSV files from the hw11 files.zip folder on Canvas, into the directory you're
You will need to extract the sample CSV files from the hw11 files.zip folder on Canvas, into the directory you're
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
In python
![Copy the following if name
main
"block
into your hw11.py file, and comment out tests for parts of
the class you haven't implemented yet. The lines that
have output include the expected value next to them as a
comment (note that you will likely not exactly match the
memory addresses shown for the Boat objects).
You will need to extract the sample CSV files from the
hw11 files.zip folder on Canvas, into the directory you're
running Python from.
if
_name_ =
the_race =
Boat Race('the_big_one.csv')
'___main__':
print(the_race.get_race_name())
print(the_race.get_race_id()) #11
print (type(the_race.race_id))
#<class 'int'>
#The Big One
#120
print(the_race.get_distance())
print (type (the_race.distance))
#<class 'int'>
print(the_race.get_racers())
#[<__main__.Boat object at
0×03A2E4C0>, <_main__.Boat object at
0x03A2E4F0>]
print(type(the_race.get_racers()[0].to
p_speed)) # <class 'int'>](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3d6be129-a50c-48b0-9160-a35dac7d050c%2Fcc7045fc-508e-4787-977e-c8f464d73f1d%2F5brgbkj_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Copy the following if name
main
"block
into your hw11.py file, and comment out tests for parts of
the class you haven't implemented yet. The lines that
have output include the expected value next to them as a
comment (note that you will likely not exactly match the
memory addresses shown for the Boat objects).
You will need to extract the sample CSV files from the
hw11 files.zip folder on Canvas, into the directory you're
running Python from.
if
_name_ =
the_race =
Boat Race('the_big_one.csv')
'___main__':
print(the_race.get_race_name())
print(the_race.get_race_id()) #11
print (type(the_race.race_id))
#<class 'int'>
#The Big One
#120
print(the_race.get_distance())
print (type (the_race.distance))
#<class 'int'>
print(the_race.get_racers())
#[<__main__.Boat object at
0×03A2E4C0>, <_main__.Boat object at
0x03A2E4F0>]
print(type(the_race.get_racers()[0].to
p_speed)) # <class 'int'>

Transcribed Image Text:Define a class named BoatRace that contains the
following information about a Boat Race:
1) race_name: string
2) race_id: int
3) distance: int
4) racers: List of Boat objects
Write a constructor that allows the programmer to
create an object of type BoatRace with a
race_name, race_id, list of racers objects, and
distance.
O
O
The constructor will only take in one
parameter, a string representing the name
of a CSV file. The file will have the
following format:
■ Each row will always have exactly
two columns.
■ The first row will always contain
the name of the race.
■ The second row will always
contain the id number for the race.
■ The third row will always contain
the distance for the race.
■ All remaining rows contain
information about the boats
involved in the race: the first
column will be the name of the
boat, and the second column is that
boat's top speed. For example, the
race in the file below has two
boats: The Fire Ball with top speed
12, and The Leaf with top speed
100.
Name, The Big One
ID, 11
Distance, 120
The Fire Ball, 12
The Leaf, 100
The constructor must read the information
from the file and use it to initialize the
appropriate instance variables. Keep in
mind that the race id and distance for the
race should be converted to an integer, as
should the top speed for each boat.
The racers instance variable is a list of
Boat objects. This means that you will
need to use the Boat constructor from
problem A to create a Boat object from
the information in each row past the third.
Provide a getter for the following instance
variables with no input parameters (other than
self) passed in:
get_race_name returns the race_name
O get_race_id returns the race_id
get_distance returns the distance
O get_racers returns the racers
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY