Question

Define a DNA class: Please consider the features of Java classes, and then define a Java...

Define a DNA class:

Please consider the features of Java classes, and then define a Java class for a DNA sequence object to include instance variable names and methods that you can use to define a piece of DNA sequence. You can use a UML (Universal Modeling Language) diagram to define your class, or you can simply list the variable, and method's names, data type, and parameters the methods will take in.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE

class DNA {

private String title, nucleo, nucleoFixed;

private double totalMass;

private boolean isProtein;

public DNA(String title, String nucleo, String nucleoFixed, double totalMass, boolean isProtein) {

this.title = title;

this.nucleo = nucleo;

this.nucleoFixed = nucleoFixed;

this.totalMass = totalMass;

this.isProtein = isProtein;

}

public String getTitle() {

return title;

}

public void setTitle(String title) {

this.title = title;

}

public String getNucleo() {

return nucleo;

}

public void setNucleo(String nucleo) {

this.nucleo = nucleo;

}

public String getNucleoFixed() {

return nucleoFixed;

}

public void setNucleoFixed(String nucleoFixed) {

this.nucleoFixed = nucleoFixed;

}

public double getTotalMass() {

return totalMass;

}

public void setTotalMass(double totalMass) {

this.totalMass = totalMass;

}

public boolean isProtein() {

return isProtein;

}

public void setProtein(boolean isProtein) {

this.isProtein = isProtein;

}

@Override

public String toString() {

return "DNA [title=" + title + ", nucleo=" + nucleo + ", nucleoFixed=" + nucleoFixed + ", totalMass="

+ totalMass + ", isProtein=" + isProtein + "]";

}

}

​​​​​​​

Add a comment
Know the answer?
Add Answer to:
Define a DNA class: Please consider the features of Java classes, and then define a Java...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java is an object-oriented programming language that enables us to define classes and to instantiate them...

    Java is an object-oriented programming language that enables us to define classes and to instantiate them into objects. These objects then call each other’s methods to implement the behavior of the application. The Unified Modeling Language (UML) is an object-oriented visual notation to document the design of object-oriented classes. For this discussion, you will practice designing a Java class called Course, drawing a UML class diagram for the Course class, and then implementing the Course class in Java code. Review...

  • Java Create four classes: 1.      An Animal class that acts as a superclass for Dog and...

    Java Create four classes: 1.      An Animal class that acts as a superclass for Dog and Bird 2.      A Bird class that is a descendant of Animal 3.      A Dog class that is a descendant of Animal 4.      A “driver” class named driver that instantiates an Animal, a Dog, and a Bird object. The Animal class has: ·        one instance variable, a private String variable named   name ·        a single constructor that takes one argument, a String, used to set...

  • Create a UML diagram to help design the class described in exercise 3 below. Do this...

    Create a UML diagram to help design the class described in exercise 3 below. Do this exercise before you attempt to code the solution. Think about what instance variables will be required to describe a Baby class object; should they be private or public? Determine what class methods are required; should they be private or public? Write Java code for a Baby class. A Baby has a name of type String and an age of type integer. Supply two constructors:...

  • This is in Java, thanks! d Define two subclasses as below: 1) “Advanced Java” with an...

    This is in Java, thanks! d Define two subclasses as below: 1) “Advanced Java” with an additional field called “grades_in_class” 2) “Web Technology” with an additional field called “grades_Quizzes”. Define the required constructors and getter methods in both classes. e Override the computeGrade() in both classes as below: 1. In Advanced Java, Fgrade= 40%* avg_exams+ 40%* avg_Assignments + 20* grades_in_class 2. In Web Technology, Fgrade= 30%* avg_exams+ 50%* avg_Assignments + 20*grades_Quizzes Note: Fgrade is a local variable in the computeGrade()...

  • in BASIC/BEGINNER OBJECT ORIENTATED JAVA Please write code for the following program using comments explaining the...

    in BASIC/BEGINNER OBJECT ORIENTATED JAVA Please write code for the following program using comments explaining the code. (You can hand write this). Give a UML example illustrating AGGREGATION. Include classes, fields, methods, instance fields. USE ONE SUPER CLASS AND TWO SUB CLASSES. Include pcode for at least one method of each class. Explain the whole part relationship and if this a deep or shallow copy.

  • This is the question about object-oriend programming(java) please show the detail comment and prefect code of...

    This is the question about object-oriend programming(java) please show the detail comment and prefect code of each class, Thank you! This question contain 7 parts(questions) Question 1 Create a class a class Cat with the following UML diagram: (the "-" means private , "+" means public) +-----------------------------------+ | Cat | +-----------------------------------+ | - name: String | | - weight: double | +-----------------------------------+ | + Cat(String name, double weight) | | + getName(): String | | + getWeight(): double | |...

  • In c# So far, you have created object-oriented code for individual classes. You have built objects...

    In c# So far, you have created object-oriented code for individual classes. You have built objects from these classes. Last week, you created a UML for new inherited classes and objects. Finally, you have used polymorphism. When you add abstraction to this mix, you have the “4 Pillars of OOP.” Now, you begin putting the pieces together to create larger object-oriented programs. Objectives for the project are: Create OO classes that contain inherited and polymorphic members Create abstracted classes and...

  • JAVA :The following are descriptions of classes that you will create. Think of these as service...

    JAVA :The following are descriptions of classes that you will create. Think of these as service providers. They provide a service to who ever want to use them. You will also write a TestClass with a main() method that fully exercises the classes that you create. To exercise a class, make some instances of the class, and call the methods of the class using these objects. Paste in the output from the test program that demonstrates your classes’ functionality. Testing...

  • Computer Science 111 Introduction to Algorithms and Programming: Java Programming Net Beans Project #4 - Classes...

    Computer Science 111 Introduction to Algorithms and Programming: Java Programming Net Beans Project #4 - Classes and Objects (15 Points) You will create 3 new classes for this project, two will be chosen (THE TWO CHOSEN ARE TENNIS SHOE AND TREE) from the list below and one will be an entirely new class you invent. Here is the list: Cellphone Clothes JuiceDrink Book MusicBand Bike GameConsole Tree Automobile Baseball MusicPlayer Laptop TennisShoe Cartoon EnergyDrink TabletComputer RealityShow HalloweenCostume Design First Create...

  • Java Object Array With 2 Elements In 1 Object

    1. Create a UML diagram to help design the class described in Q2 below. Do this exercise before you attempt to code the solution. Think about what instance variables will be required to describe a Person class object; should they be private or public? Determine what class methods are required; should they be private or public?2. Write Java code for a Person class. A Person has a name of type String and an age of type integer.Supply two constructors: one will be...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT