Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a class Line that implements a line, which is represented by the formula

ID: 3648769 • Letter: D

Question

Design a class Line that implements a line, which is represented by the formula y=ax+b. Your class should store a and b as double member vari-ables. Write a member function intersect(?) that returns the x coordinate at which this line intersects line ?. If the two lines are parallel, then your function should throw an exception Parallel. Write a C++ program that creates a number of Line objects and tests each pair for intersection. Your program should print an appropriate error message for parallel lines.

Explanation / Answer

public class dog { //Attributes [i.e. data] private String name; private String owner; private String breed; private int age; //Behavior [i.e. methods] //Constructors public dog() //constructor which takes no parameters, sets to default { name=""; owner=""; breed=""; age=0; } //fully parameterized constructor public dog(String name, String owner, String breed, int age) { this.name=name; this.owner=owner; this.breed=breed; this.age=age; } //copy constructor public dog(dog someDog) { this.name=someDog.getName(); this.owner=someDog.getOwner(); this.breed=someDog.getBreed(); this.age=someDog.getAge(); } //other behavior (non-constructor behavior) public String getName() { return name; } public String getOwner() { return owner; } public String getBreed() { return breed; } public int getAge() { return age; } public int computeYearsToLive() { int toLive; if(breed.equalsIgnoreCase("german")) { toLive=15-age; } else if(breed.equalsIgnoreCase("boxer")) { toLive=11-age; } else if(breed.equalsIgnoreCase("terrier")) { toLive=8-age; } else if(breed.equalsIgnoreCase("doberman")) { toLive=13-age; } else { toLive=14-age; } return toLive; }//end method computeYearsToLive() }//end class file kennel.java import javax.swing.JOptionPane; public class kennel { public static void main( String args[] ) { String tempName="",tempOwner="", tempBreed="", output=""; int tempAge, c, counter; dog dogArray[] = new dog[10]; for( c=0 ; c
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote