SlideShare a Scribd company logo
1 of 7
Download to read offline
//operating system linux,ubuntu,Mac
/*********************GeometricObject.java**********************/
public abstract class GeometricObject {
private String color = "white";
private boolean filled;
// default constructure
public GeometricObject() {
super();
// TODO Auto-generated constructor stub
}
// construct a Geometric Object
// parameterized constructure
public GeometricObject(String color, boolean filled) {
this.color = color;
this.filled = filled;
}
/** Getter method for color */
public String getColor() {
return color;
}
/** Setter method for color */
public void setColor(String color) {
this.color = color;
}
/**
* Getter method for filled. Since filled is boolean, so the gret method
* name is isFilled
*/
public boolean isFilled() {
return filled;
}
/** Setter method for filled */
public void setFilled(boolean filled) {
this.filled = filled;
}
/** Abstract method for FindArea */
public abstract double findArea();
/** Abstract method for findPerimeter */
public abstract double findPerimeter();
}
/*****************************Octagon.java**************/
public class Octagon extends GeometricObject implements Cloneable, Comparable {
private double side;
/** construct a Octagon with specified side */
public Octagon(double side) {
super();
this.side = side;
}
/** Implement the abstract method findArea in GeometricObject */
@Override
public double findArea() {
double area = (2 + 4 / Math.sqrt(2)) * side * side;
return area;
}
/** Implement the abstract method findArea in findPerimeter */
@Override
public double findPerimeter() {
double perimeter = 8 * side;
return perimeter;
}
/** Implement the compareTo method in Comparable interface */
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
return 0;
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}
/*******************App.java*******************/
public class App {
public static void main(String[] args) {
Octagon a1 = new Octagon(5);//creating object of octagon
System.out.println("Area of a1 is " + a1.findArea());
System.out.println("Perimeter of a1 is " + a1.findPerimeter());
Object a2;
try {
a2 = a1.clone();
String result = (a1.compareTo(a2) == 0) ? "a1 and its clone a2 have the same area"
: "a1 and its clone a2 have different areas";
System.out.println("Compare a1 and its clone a2: t " + result);
System.out.println("Hashcode of a1: " + a1.hashCode());
System.out.println("Hashcode of a2: " + a2.hashCode());
System.out.println("Displaying a1: " + a1);
System.out.println("Displaying a2: " + a2);
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
}
}
/*****************output***************/
gopal@gopal:~/Desktop/chegg$ javac GeometricObject.java
gopal@gopal:~/Desktop/chegg$ javac Octagon.java
gopal@gopal:~/Desktop/chegg$ javac App.java
gopal@gopal:~/Desktop/chegg$ java App
Area of a1 is 120.71067811865476
Perimeter of a1 is 40.0
Compare a1 and its clone a2:
a1 and its clone a2 have the same area
Hashcode of a1: 1808253012
Hashcode of a2: 589431969
Displaying a1: Octagon@6bc7c054
Displaying a2: Octagon@232204a1
Solution
//operating system linux,ubuntu,Mac
/*********************GeometricObject.java**********************/
public abstract class GeometricObject {
private String color = "white";
private boolean filled;
// default constructure
public GeometricObject() {
super();
// TODO Auto-generated constructor stub
}
// construct a Geometric Object
// parameterized constructure
public GeometricObject(String color, boolean filled) {
this.color = color;
this.filled = filled;
}
/** Getter method for color */
public String getColor() {
return color;
}
/** Setter method for color */
public void setColor(String color) {
this.color = color;
}
/**
* Getter method for filled. Since filled is boolean, so the gret method
* name is isFilled
*/
public boolean isFilled() {
return filled;
}
/** Setter method for filled */
public void setFilled(boolean filled) {
this.filled = filled;
}
/** Abstract method for FindArea */
public abstract double findArea();
/** Abstract method for findPerimeter */
public abstract double findPerimeter();
}
/*****************************Octagon.java**************/
public class Octagon extends GeometricObject implements Cloneable, Comparable {
private double side;
/** construct a Octagon with specified side */
public Octagon(double side) {
super();
this.side = side;
}
/** Implement the abstract method findArea in GeometricObject */
@Override
public double findArea() {
double area = (2 + 4 / Math.sqrt(2)) * side * side;
return area;
}
/** Implement the abstract method findArea in findPerimeter */
@Override
public double findPerimeter() {
double perimeter = 8 * side;
return perimeter;
}
/** Implement the compareTo method in Comparable interface */
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
return 0;
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}
/*******************App.java*******************/
public class App {
public static void main(String[] args) {
Octagon a1 = new Octagon(5);//creating object of octagon
System.out.println("Area of a1 is " + a1.findArea());
System.out.println("Perimeter of a1 is " + a1.findPerimeter());
Object a2;
try {
a2 = a1.clone();
String result = (a1.compareTo(a2) == 0) ? "a1 and its clone a2 have the same area"
: "a1 and its clone a2 have different areas";
System.out.println("Compare a1 and its clone a2: t " + result);
System.out.println("Hashcode of a1: " + a1.hashCode());
System.out.println("Hashcode of a2: " + a2.hashCode());
System.out.println("Displaying a1: " + a1);
System.out.println("Displaying a2: " + a2);
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
}
}
/*****************output***************/
gopal@gopal:~/Desktop/chegg$ javac GeometricObject.java
gopal@gopal:~/Desktop/chegg$ javac Octagon.java
gopal@gopal:~/Desktop/chegg$ javac App.java
gopal@gopal:~/Desktop/chegg$ java App
Area of a1 is 120.71067811865476
Perimeter of a1 is 40.0
Compare a1 and its clone a2:
a1 and its clone a2 have the same area
Hashcode of a1: 1808253012
Hashcode of a2: 589431969
Displaying a1: Octagon@6bc7c054
Displaying a2: Octagon@232204a1

More Related Content

Similar to operating system linux,ubuntu,Mac Geometri.pdf

@author public class Person{   String sname, .pdf
  @author   public class Person{   String sname, .pdf  @author   public class Person{   String sname, .pdf
@author public class Person{   String sname, .pdfaplolomedicalstoremr
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfsiennatimbok52331
 
java write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfjava write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfarjuntelecom26
 
BasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdfBasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdfankitmobileshop235
 
Polygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdfPolygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdfapnafreez
 
Polygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdfPolygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdfapnafreez
 
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfModify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfarjuncorner565
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokusHamletDRC
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfcontact41
 
PickerApp CLass.pdf
 PickerApp CLass.pdf PickerApp CLass.pdf
PickerApp CLass.pdfankitcom
 
GeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good TestsGeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good TestsTomek Kaczanowski
 
Tested on EclipseBoth class should be in same package.pdf
Tested on EclipseBoth class should be in same package.pdfTested on EclipseBoth class should be in same package.pdf
Tested on EclipseBoth class should be in same package.pdfanupamagarud8
 
Confitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good TestsConfitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good TestsTomek Kaczanowski
 
Design patterns
Design patternsDesign patterns
Design patternsBa Tran
 
Algoritmos sujei
Algoritmos sujeiAlgoritmos sujei
Algoritmos sujeigersonjack
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good TestsTomek Kaczanowski
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Tsuyoshi Yamamoto
 

Similar to operating system linux,ubuntu,Mac Geometri.pdf (20)

@author public class Person{   String sname, .pdf
  @author   public class Person{   String sname, .pdf  @author   public class Person{   String sname, .pdf
@author public class Person{   String sname, .pdf
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
 
java write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdfjava write a program to evaluate the postfix expressionthe program.pdf
java write a program to evaluate the postfix expressionthe program.pdf
 
BasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdfBasicPizza.javapublic class BasicPizza { Declaring instance .pdf
BasicPizza.javapublic class BasicPizza { Declaring instance .pdf
 
Polygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdfPolygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdf
 
Polygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdfPolygon.javapublic class Polygon { private int numSides; priva.pdf
Polygon.javapublic class Polygon { private int numSides; priva.pdf
 
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfModify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
 
ETM Server
ETM ServerETM Server
ETM Server
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdf
 
Php 5.6
Php 5.6Php 5.6
Php 5.6
 
PickerApp CLass.pdf
 PickerApp CLass.pdf PickerApp CLass.pdf
PickerApp CLass.pdf
 
GeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good TestsGeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good Tests
 
Tested on EclipseBoth class should be in same package.pdf
Tested on EclipseBoth class should be in same package.pdfTested on EclipseBoth class should be in same package.pdf
Tested on EclipseBoth class should be in same package.pdf
 
Confitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good TestsConfitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good Tests
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Google guava
Google guavaGoogle guava
Google guava
 
Algoritmos sujei
Algoritmos sujeiAlgoritmos sujei
Algoritmos sujei
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 

More from aquadreammail

A. In order to survive inside the body of the host, a pathogen must .pdf
A. In order to survive inside the body of the host, a pathogen must .pdfA. In order to survive inside the body of the host, a pathogen must .pdf
A. In order to survive inside the body of the host, a pathogen must .pdfaquadreammail
 
10) The Correct answer is improvements in learning through hypnosis .pdf
10) The Correct answer is improvements in learning through hypnosis .pdf10) The Correct answer is improvements in learning through hypnosis .pdf
10) The Correct answer is improvements in learning through hypnosis .pdfaquadreammail
 
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
1.1.The words ‘data’ and ‘information’ are often used as though they.pdfaquadreammail
 
1. Osmotic pressure = imRTwhere m = molality of solute, R = molar.pdf
1. Osmotic pressure  = imRTwhere m = molality of solute, R = molar.pdf1. Osmotic pressure  = imRTwhere m = molality of solute, R = molar.pdf
1. Osmotic pressure = imRTwhere m = molality of solute, R = molar.pdfaquadreammail
 
1-Children are more susceptible to Trichurus species be it male or f.pdf
1-Children are more susceptible to Trichurus species be it male or f.pdf1-Children are more susceptible to Trichurus species be it male or f.pdf
1-Children are more susceptible to Trichurus species be it male or f.pdfaquadreammail
 
Javac code for the manager of the Jeter County softball teamimp.pdf
 Javac code for the manager of the Jeter County softball teamimp.pdf Javac code for the manager of the Jeter County softball teamimp.pdf
Javac code for the manager of the Jeter County softball teamimp.pdfaquadreammail
 
1) Mitochondria are known as power houses of cell. The mitochondria .pdf
1) Mitochondria are known as power houses of cell. The mitochondria .pdf1) Mitochondria are known as power houses of cell. The mitochondria .pdf
1) Mitochondria are known as power houses of cell. The mitochondria .pdfaquadreammail
 
the molecule is 2,2-dichloro-ethanol all carbons.pdf
                     the molecule is 2,2-dichloro-ethanol  all carbons.pdf                     the molecule is 2,2-dichloro-ethanol  all carbons.pdf
the molecule is 2,2-dichloro-ethanol all carbons.pdfaquadreammail
 
Increases. Gases have higher entropy than liquids.pdf
                     Increases. Gases have higher entropy than liquids.pdf                     Increases. Gases have higher entropy than liquids.pdf
Increases. Gases have higher entropy than liquids.pdfaquadreammail
 
Simple C++ program to multiply two polynomials#include iostrea.pdf
 Simple C++ program to multiply two polynomials#include iostrea.pdf Simple C++ program to multiply two polynomials#include iostrea.pdf
Simple C++ program to multiply two polynomials#include iostrea.pdfaquadreammail
 
design and deliver an confirmation based academic and instruction sy.pdf
  design and deliver an confirmation based academic and instruction sy.pdf  design and deliver an confirmation based academic and instruction sy.pdf
design and deliver an confirmation based academic and instruction sy.pdfaquadreammail
 
OK, let me try to talk you through this. The arro.pdf
                     OK, let me try to talk you through this. The arro.pdf                     OK, let me try to talk you through this. The arro.pdf
OK, let me try to talk you through this. The arro.pdfaquadreammail
 
x=input(Enter the first sequence ); l1=input(Enter the lowe.pdf
x=input(Enter the first sequence ); l1=input(Enter the lowe.pdfx=input(Enter the first sequence ); l1=input(Enter the lowe.pdf
x=input(Enter the first sequence ); l1=input(Enter the lowe.pdfaquadreammail
 
Yes , we can view .Xmzx files are encoded files that take to be un.pdf
Yes , we can view .Xmzx files are encoded files that take to be un.pdfYes , we can view .Xmzx files are encoded files that take to be un.pdf
Yes , we can view .Xmzx files are encoded files that take to be un.pdfaquadreammail
 
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdfThe middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdfaquadreammail
 
The link provided by your teacher is a popular article based on the .pdf
The link provided by your teacher is a popular article based on the .pdfThe link provided by your teacher is a popular article based on the .pdf
The link provided by your teacher is a popular article based on the .pdfaquadreammail
 
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdfEPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdfaquadreammail
 
The answer is D) IIA buffer system must contain a weak acid and i.pdf
The answer is D) IIA buffer system must contain a weak acid and i.pdfThe answer is D) IIA buffer system must contain a weak acid and i.pdf
The answer is D) IIA buffer system must contain a weak acid and i.pdfaquadreammail
 
c. underwent morphogenesis between the early and late gastrula stage.pdf
c. underwent morphogenesis between the early and late gastrula stage.pdfc. underwent morphogenesis between the early and late gastrula stage.pdf
c. underwent morphogenesis between the early and late gastrula stage.pdfaquadreammail
 
Text Component FeaturesThe JTextComponent class is the foundation .pdf
Text Component FeaturesThe JTextComponent class is the foundation .pdfText Component FeaturesThe JTextComponent class is the foundation .pdf
Text Component FeaturesThe JTextComponent class is the foundation .pdfaquadreammail
 

More from aquadreammail (20)

A. In order to survive inside the body of the host, a pathogen must .pdf
A. In order to survive inside the body of the host, a pathogen must .pdfA. In order to survive inside the body of the host, a pathogen must .pdf
A. In order to survive inside the body of the host, a pathogen must .pdf
 
10) The Correct answer is improvements in learning through hypnosis .pdf
10) The Correct answer is improvements in learning through hypnosis .pdf10) The Correct answer is improvements in learning through hypnosis .pdf
10) The Correct answer is improvements in learning through hypnosis .pdf
 
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
1.1.The words ‘data’ and ‘information’ are often used as though they.pdf
 
1. Osmotic pressure = imRTwhere m = molality of solute, R = molar.pdf
1. Osmotic pressure  = imRTwhere m = molality of solute, R = molar.pdf1. Osmotic pressure  = imRTwhere m = molality of solute, R = molar.pdf
1. Osmotic pressure = imRTwhere m = molality of solute, R = molar.pdf
 
1-Children are more susceptible to Trichurus species be it male or f.pdf
1-Children are more susceptible to Trichurus species be it male or f.pdf1-Children are more susceptible to Trichurus species be it male or f.pdf
1-Children are more susceptible to Trichurus species be it male or f.pdf
 
Javac code for the manager of the Jeter County softball teamimp.pdf
 Javac code for the manager of the Jeter County softball teamimp.pdf Javac code for the manager of the Jeter County softball teamimp.pdf
Javac code for the manager of the Jeter County softball teamimp.pdf
 
1) Mitochondria are known as power houses of cell. The mitochondria .pdf
1) Mitochondria are known as power houses of cell. The mitochondria .pdf1) Mitochondria are known as power houses of cell. The mitochondria .pdf
1) Mitochondria are known as power houses of cell. The mitochondria .pdf
 
the molecule is 2,2-dichloro-ethanol all carbons.pdf
                     the molecule is 2,2-dichloro-ethanol  all carbons.pdf                     the molecule is 2,2-dichloro-ethanol  all carbons.pdf
the molecule is 2,2-dichloro-ethanol all carbons.pdf
 
Increases. Gases have higher entropy than liquids.pdf
                     Increases. Gases have higher entropy than liquids.pdf                     Increases. Gases have higher entropy than liquids.pdf
Increases. Gases have higher entropy than liquids.pdf
 
Simple C++ program to multiply two polynomials#include iostrea.pdf
 Simple C++ program to multiply two polynomials#include iostrea.pdf Simple C++ program to multiply two polynomials#include iostrea.pdf
Simple C++ program to multiply two polynomials#include iostrea.pdf
 
design and deliver an confirmation based academic and instruction sy.pdf
  design and deliver an confirmation based academic and instruction sy.pdf  design and deliver an confirmation based academic and instruction sy.pdf
design and deliver an confirmation based academic and instruction sy.pdf
 
OK, let me try to talk you through this. The arro.pdf
                     OK, let me try to talk you through this. The arro.pdf                     OK, let me try to talk you through this. The arro.pdf
OK, let me try to talk you through this. The arro.pdf
 
x=input(Enter the first sequence ); l1=input(Enter the lowe.pdf
x=input(Enter the first sequence ); l1=input(Enter the lowe.pdfx=input(Enter the first sequence ); l1=input(Enter the lowe.pdf
x=input(Enter the first sequence ); l1=input(Enter the lowe.pdf
 
Yes , we can view .Xmzx files are encoded files that take to be un.pdf
Yes , we can view .Xmzx files are encoded files that take to be un.pdfYes , we can view .Xmzx files are encoded files that take to be un.pdf
Yes , we can view .Xmzx files are encoded files that take to be un.pdf
 
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdfThe middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
The middle Carbon is the SP hybridized atom.SP hybrid orbitals con.pdf
 
The link provided by your teacher is a popular article based on the .pdf
The link provided by your teacher is a popular article based on the .pdfThe link provided by your teacher is a popular article based on the .pdf
The link provided by your teacher is a popular article based on the .pdf
 
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdfEPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
EPO, hematopoietin, or hemopoietin, is a glycoprotein hormone that c.pdf
 
The answer is D) IIA buffer system must contain a weak acid and i.pdf
The answer is D) IIA buffer system must contain a weak acid and i.pdfThe answer is D) IIA buffer system must contain a weak acid and i.pdf
The answer is D) IIA buffer system must contain a weak acid and i.pdf
 
c. underwent morphogenesis between the early and late gastrula stage.pdf
c. underwent morphogenesis between the early and late gastrula stage.pdfc. underwent morphogenesis between the early and late gastrula stage.pdf
c. underwent morphogenesis between the early and late gastrula stage.pdf
 
Text Component FeaturesThe JTextComponent class is the foundation .pdf
Text Component FeaturesThe JTextComponent class is the foundation .pdfText Component FeaturesThe JTextComponent class is the foundation .pdf
Text Component FeaturesThe JTextComponent class is the foundation .pdf
 

Recently uploaded

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonhttgc7rh9c
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfstareducators107
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use CasesTechSoup
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxCeline George
 

Recently uploaded (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 

operating system linux,ubuntu,Mac Geometri.pdf

  • 1. //operating system linux,ubuntu,Mac /*********************GeometricObject.java**********************/ public abstract class GeometricObject { private String color = "white"; private boolean filled; // default constructure public GeometricObject() { super(); // TODO Auto-generated constructor stub } // construct a Geometric Object // parameterized constructure public GeometricObject(String color, boolean filled) { this.color = color; this.filled = filled; } /** Getter method for color */ public String getColor() { return color; } /** Setter method for color */ public void setColor(String color) { this.color = color; } /** * Getter method for filled. Since filled is boolean, so the gret method * name is isFilled */ public boolean isFilled() { return filled; } /** Setter method for filled */ public void setFilled(boolean filled) { this.filled = filled; }
  • 2. /** Abstract method for FindArea */ public abstract double findArea(); /** Abstract method for findPerimeter */ public abstract double findPerimeter(); } /*****************************Octagon.java**************/ public class Octagon extends GeometricObject implements Cloneable, Comparable { private double side; /** construct a Octagon with specified side */ public Octagon(double side) { super(); this.side = side; } /** Implement the abstract method findArea in GeometricObject */ @Override public double findArea() { double area = (2 + 4 / Math.sqrt(2)) * side * side; return area; } /** Implement the abstract method findArea in findPerimeter */ @Override public double findPerimeter() { double perimeter = 8 * side; return perimeter; } /** Implement the compareTo method in Comparable interface */ @Override public int compareTo(Object o) { // TODO Auto-generated method stub return 0; } public Object clone() throws CloneNotSupportedException { return super.clone(); }
  • 3. } /*******************App.java*******************/ public class App { public static void main(String[] args) { Octagon a1 = new Octagon(5);//creating object of octagon System.out.println("Area of a1 is " + a1.findArea()); System.out.println("Perimeter of a1 is " + a1.findPerimeter()); Object a2; try { a2 = a1.clone(); String result = (a1.compareTo(a2) == 0) ? "a1 and its clone a2 have the same area" : "a1 and its clone a2 have different areas"; System.out.println("Compare a1 and its clone a2: t " + result); System.out.println("Hashcode of a1: " + a1.hashCode()); System.out.println("Hashcode of a2: " + a2.hashCode()); System.out.println("Displaying a1: " + a1); System.out.println("Displaying a2: " + a2); } catch (CloneNotSupportedException e) { e.printStackTrace(); } } } /*****************output***************/ gopal@gopal:~/Desktop/chegg$ javac GeometricObject.java gopal@gopal:~/Desktop/chegg$ javac Octagon.java gopal@gopal:~/Desktop/chegg$ javac App.java gopal@gopal:~/Desktop/chegg$ java App Area of a1 is 120.71067811865476 Perimeter of a1 is 40.0 Compare a1 and its clone a2: a1 and its clone a2 have the same area Hashcode of a1: 1808253012 Hashcode of a2: 589431969
  • 4. Displaying a1: Octagon@6bc7c054 Displaying a2: Octagon@232204a1 Solution //operating system linux,ubuntu,Mac /*********************GeometricObject.java**********************/ public abstract class GeometricObject { private String color = "white"; private boolean filled; // default constructure public GeometricObject() { super(); // TODO Auto-generated constructor stub } // construct a Geometric Object // parameterized constructure public GeometricObject(String color, boolean filled) { this.color = color; this.filled = filled; } /** Getter method for color */ public String getColor() { return color; } /** Setter method for color */ public void setColor(String color) { this.color = color; } /** * Getter method for filled. Since filled is boolean, so the gret method * name is isFilled */ public boolean isFilled() { return filled; }
  • 5. /** Setter method for filled */ public void setFilled(boolean filled) { this.filled = filled; } /** Abstract method for FindArea */ public abstract double findArea(); /** Abstract method for findPerimeter */ public abstract double findPerimeter(); } /*****************************Octagon.java**************/ public class Octagon extends GeometricObject implements Cloneable, Comparable { private double side; /** construct a Octagon with specified side */ public Octagon(double side) { super(); this.side = side; } /** Implement the abstract method findArea in GeometricObject */ @Override public double findArea() { double area = (2 + 4 / Math.sqrt(2)) * side * side; return area; } /** Implement the abstract method findArea in findPerimeter */ @Override public double findPerimeter() { double perimeter = 8 * side; return perimeter; } /** Implement the compareTo method in Comparable interface */ @Override public int compareTo(Object o) { // TODO Auto-generated method stub return 0;
  • 6. } public Object clone() throws CloneNotSupportedException { return super.clone(); } } /*******************App.java*******************/ public class App { public static void main(String[] args) { Octagon a1 = new Octagon(5);//creating object of octagon System.out.println("Area of a1 is " + a1.findArea()); System.out.println("Perimeter of a1 is " + a1.findPerimeter()); Object a2; try { a2 = a1.clone(); String result = (a1.compareTo(a2) == 0) ? "a1 and its clone a2 have the same area" : "a1 and its clone a2 have different areas"; System.out.println("Compare a1 and its clone a2: t " + result); System.out.println("Hashcode of a1: " + a1.hashCode()); System.out.println("Hashcode of a2: " + a2.hashCode()); System.out.println("Displaying a1: " + a1); System.out.println("Displaying a2: " + a2); } catch (CloneNotSupportedException e) { e.printStackTrace(); } } } /*****************output***************/ gopal@gopal:~/Desktop/chegg$ javac GeometricObject.java gopal@gopal:~/Desktop/chegg$ javac Octagon.java gopal@gopal:~/Desktop/chegg$ javac App.java gopal@gopal:~/Desktop/chegg$ java App Area of a1 is 120.71067811865476 Perimeter of a1 is 40.0
  • 7. Compare a1 and its clone a2: a1 and its clone a2 have the same area Hashcode of a1: 1808253012 Hashcode of a2: 589431969 Displaying a1: Octagon@6bc7c054 Displaying a2: Octagon@232204a1