Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Classes and Objects Class name = Index. The Index class will have two attributes: 1. state and it holds a string, 2. size and it

Classes and Objects

Class name = Index. The Index class will have two attributes: 1. "state" and it holds a string, 2. "size" and it holds the length of state (hint*** use "len" to find size)

Index class will have 3 methods:

1.) __init__ () method:

will accept a string myDNA which is passed into it and will verify that it has only A, C, T, and Gs in it.

if myDNA is not a valid, __init__ will print an error message AND sets state to be the empty string.

It will also set the size attribute.

2.) whereIsStop() method:

This will will read down state to see if there is a stop codon (TGA, TAA,TAG): if no stop codon then whereIsStop will return "-1". If there is a stop codon then whereIsStop will return the index of the first letter in that codon.

3.) correctLength() method:

If the contig has no stop codons, then this returns its length.

If the contig has a stop codon then this returns the length of everything before it begins. (***Hint: if the first stop codon appears at indices 10,11,12 then the part before the stop codon is at indices 0,1,2,3,4,5,6,7,8,9 and the length = 10.)

hint*** correctLength() method should use the whereIsStop() method.

Once you have defined Index class, run through it with:

StringA = ACTTAATGA

StringB = ACTACTACT

StringC = FTAFTGGG (*** hint: should get error message)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions