SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 305 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 06 Jan 2018 My Price 10.00

virtual aquarium, and then manipulate it using a simple

Use Python:

In this lab,

Use classes to create a virtual aquarium, and then manipulate it using a simple sorting algorithm known as "bubble sort".

1. Start by defining a new Fish class, which will represent a single fish in our aquarium. A Fish has four instance variables (its name, its species, its color, and its weight in ounces). Every Fish also has the following methods (with the following headers):

     a. __init__(self, name, species, color, weight)

     This method creates four new instance variables for the Fish, and assigns them the values of the last four method parameters. Remember that an instance variable's name is always preceded by "self.", as in self.myData. 

     b. __repr__(self)

     This method returns a string representing the current Fish. This string should include a crude fish symbol (<><) followed by the Fish's name, color, and species in parentheses. For example: <>< (Topper, blue Guppy) 

     c. __lt__(self, other) 

     This method returns True if the current Fish's weight is less than the other Fish's weight instance variable, and False otherwise. Remember that Python does not protect instance variables from outside access, so you can directly refer to, for example, other.weight. 

     d. kind(self)

     This method returns the species of the current Fish.

.........(in Lab 7.PDF attached)

  • # CSE 101 Lab 7
    # Name:
    # SBU ID #

    # ADD YOUR CLASS DEFINITIONS HERE



    # ADD YOUR DRIVER CODE HERE

    if __name__ == "__main__":
        cap = int(input("How many gallons of water can the tank hold? "))
        source = input("Enter the name of the file containing the list of fish: ")

        # ADD THE REST OF YOUR CODE HERE
     

Attachments:

Answers

(5)
Status NEW Posted 06 Jan 2018 02:01 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)