SlideShare a Scribd company logo
1 of 7
Download to read offline
//These are my codes. They are exactly similar to the above ones. Unless you missed some small
sytax. They run perfectly fine. Which environment are you using to compile and run these
programs?
ColorPencil.java
public class ColorPencil {
private String color;
private double length;
private double thickness;
public ColorPencil(String cpColor,double cpLength,double cpThickness)
{
color = cpColor;
length = cpLength;
thickness = cpThickness;
}
public ColorPencil()
{
color = "Black";
length = 6.0;
thickness = 1.5;
}
public void setColor(String cpColor)
{
color = cpColor;
}
public void setLength(double cpLength)
{
length = cpLength;
}
public void setThickness(double cpThickness)
{
thickness = cpThickness;
}
public String getColor()
{
return color;
}
public double getLength()
{
return length;
}
public double getThickness()
{
return thickness;
}
public String newColor(String cpColor)
{
color = cpColor;
return color;
}
public double newLength(double cpLength)
{
length = cpLength;
return length;
}
public double newThickness(double cpThickness)
{
thickness = cpThickness;
return thickness;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
ColorPencilTest.java
public class ColorPencilTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
ColorPencil change = new ColorPencil();
String origColor = change.getColor();
double origLength = change.getLength();
double origThickness = change.getThickness();
System.out.println("Original color of the pencil is "+origColor+" Original length of the
pencil is "+origLength+" Original thickness of the pencil is "+origThickness);
String color1 = "Pink";
change.setColor(color1);
System.out.println("Color of the pencil is now "+color1);
double length1 = 5.5;
change.setLength(length1);
System.out.println("Length of the pencil is now "+length1);
double thickness1 = 0.7;
change.setThickness(thickness1);
System.out.println("Thickness of the pencil is now "+thickness1);
}
}
Solution
//These are my codes. They are exactly similar to the above ones. Unless you missed some small
sytax. They run perfectly fine. Which environment are you using to compile and run these
programs?
ColorPencil.java
public class ColorPencil {
private String color;
private double length;
private double thickness;
public ColorPencil(String cpColor,double cpLength,double cpThickness)
{
color = cpColor;
length = cpLength;
thickness = cpThickness;
}
public ColorPencil()
{
color = "Black";
length = 6.0;
thickness = 1.5;
}
public void setColor(String cpColor)
{
color = cpColor;
}
public void setLength(double cpLength)
{
length = cpLength;
}
public void setThickness(double cpThickness)
{
thickness = cpThickness;
}
public String getColor()
{
return color;
}
public double getLength()
{
return length;
}
public double getThickness()
{
return thickness;
}
public String newColor(String cpColor)
{
color = cpColor;
return color;
}
public double newLength(double cpLength)
{
length = cpLength;
return length;
}
public double newThickness(double cpThickness)
{
thickness = cpThickness;
return thickness;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
ColorPencilTest.java
public class ColorPencilTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
ColorPencil change = new ColorPencil();
String origColor = change.getColor();
double origLength = change.getLength();
double origThickness = change.getThickness();
System.out.println("Original color of the pencil is "+origColor+" Original length of the
pencil is "+origLength+" Original thickness of the pencil is "+origThickness);
String color1 = "Pink";
change.setColor(color1);
System.out.println("Color of the pencil is now "+color1);
double length1 = 5.5;
change.setLength(length1);
System.out.println("Length of the pencil is now "+length1);
double thickness1 = 0.7;
change.setThickness(thickness1);
System.out.println("Thickness of the pencil is now "+thickness1);
}
}

More Related Content

Similar to These are my codes. They are exactly similar to the above ones. Un.pdf

Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APILet's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APIMario Fusco
 
Solid C++ by Example
Solid C++ by ExampleSolid C++ by Example
Solid C++ by ExampleOlve Maudal
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongMario Fusco
 
Namespace in C++ Programming Language
Namespace in C++ Programming LanguageNamespace in C++ Programming Language
Namespace in C++ Programming LanguageHimanshu Choudhary
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...Francesco Casalegno
 
The Ring programming language version 1.10 book - Part 49 of 212
The Ring programming language version 1.10 book - Part 49 of 212The Ring programming language version 1.10 book - Part 49 of 212
The Ring programming language version 1.10 book - Part 49 of 212Mahmoud Samir Fayed
 

Similar to These are my codes. They are exactly similar to the above ones. Un.pdf (8)

Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APILet's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java API
 
Solid C++ by Example
Solid C++ by ExampleSolid C++ by Example
Solid C++ by Example
 
Chap2
Chap2Chap2
Chap2
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are Wrong
 
Csharp generics
Csharp genericsCsharp generics
Csharp generics
 
Namespace in C++ Programming Language
Namespace in C++ Programming LanguageNamespace in C++ Programming Language
Namespace in C++ Programming Language
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
 
The Ring programming language version 1.10 book - Part 49 of 212
The Ring programming language version 1.10 book - Part 49 of 212The Ring programming language version 1.10 book - Part 49 of 212
The Ring programming language version 1.10 book - Part 49 of 212
 

More from anjanaarts2014

A robust whistleblowing regime is now an integral part of governance.pdf
A robust whistleblowing regime is now an integral part of governance.pdfA robust whistleblowing regime is now an integral part of governance.pdf
A robust whistleblowing regime is now an integral part of governance.pdfanjanaarts2014
 
1. In higher parts of the reef, where the wave energy is high, the c.pdf
1. In higher parts of the reef, where the wave energy is high, the c.pdf1. In higher parts of the reef, where the wave energy is high, the c.pdf
1. In higher parts of the reef, where the wave energy is high, the c.pdfanjanaarts2014
 
a)dydx + 2yx = xI.F. = x^2solution iy .pdf
a)dydx + 2yx = xI.F. = x^2solution iy .pdfa)dydx + 2yx = xI.F. = x^2solution iy .pdf
a)dydx + 2yx = xI.F. = x^2solution iy .pdfanjanaarts2014
 
23.C. 1 in 424. B. Homozygous25. B. 5026.All females will be .pdf
23.C. 1 in 424. B. Homozygous25. B. 5026.All females will be .pdf23.C. 1 in 424. B. Homozygous25. B. 5026.All females will be .pdf
23.C. 1 in 424. B. Homozygous25. B. 5026.All females will be .pdfanjanaarts2014
 
A is correct. The ntp server 10.0.0.5 command is entered in Global C.pdf
A is correct. The ntp server 10.0.0.5 command is entered in Global C.pdfA is correct. The ntp server 10.0.0.5 command is entered in Global C.pdf
A is correct. The ntp server 10.0.0.5 command is entered in Global C.pdfanjanaarts2014
 
A. Gene expression.B. Transcription factor.C. Gene expression..pdf
A. Gene expression.B. Transcription factor.C. Gene expression..pdfA. Gene expression.B. Transcription factor.C. Gene expression..pdf
A. Gene expression.B. Transcription factor.C. Gene expression..pdfanjanaarts2014
 
All are capable to grow in lactose medium . In presence of lactose t.pdf
All are capable to grow in lactose medium . In presence of lactose t.pdfAll are capable to grow in lactose medium . In presence of lactose t.pdf
All are capable to grow in lactose medium . In presence of lactose t.pdfanjanaarts2014
 
1)The viruse which is the most dangerous threat.In DTI survey,72 of.pdf
1)The viruse which is the most dangerous threat.In DTI survey,72 of.pdf1)The viruse which is the most dangerous threat.In DTI survey,72 of.pdf
1)The viruse which is the most dangerous threat.In DTI survey,72 of.pdfanjanaarts2014
 
HClO3 + NaOH NaClO3 +H2O n(HClO3) = 0.10.04 = 4.pdf
                     HClO3 + NaOH  NaClO3 +H2O n(HClO3) = 0.10.04 = 4.pdf                     HClO3 + NaOH  NaClO3 +H2O n(HClO3) = 0.10.04 = 4.pdf
HClO3 + NaOH NaClO3 +H2O n(HClO3) = 0.10.04 = 4.pdfanjanaarts2014
 
I have already answered it. Check. .pdf
                     I have already answered it. Check.               .pdf                     I have already answered it. Check.               .pdf
I have already answered it. Check. .pdfanjanaarts2014
 
Iodide is a strong nucleophile but a weak base, s.pdf
                     Iodide is a strong nucleophile but a weak base, s.pdf                     Iodide is a strong nucleophile but a weak base, s.pdf
Iodide is a strong nucleophile but a weak base, s.pdfanjanaarts2014
 
NaCl Its the coulombic interaction between Na.pdf
                     NaCl  Its the coulombic interaction between Na.pdf                     NaCl  Its the coulombic interaction between Na.pdf
NaCl Its the coulombic interaction between Na.pdfanjanaarts2014
 
Here Jupiter is the fifth planet from the Sun a.pdf
                     Here  Jupiter is the fifth planet from the Sun a.pdf                     Here  Jupiter is the fifth planet from the Sun a.pdf
Here Jupiter is the fifth planet from the Sun a.pdfanjanaarts2014
 
moles of H+ = 42.0 x 0.120 millimoles = 5.04 mill.pdf
                     moles of H+ = 42.0 x 0.120 millimoles = 5.04 mill.pdf                     moles of H+ = 42.0 x 0.120 millimoles = 5.04 mill.pdf
moles of H+ = 42.0 x 0.120 millimoles = 5.04 mill.pdfanjanaarts2014
 
Lithium is group 1 metal, while nitrogen is group.pdf
                     Lithium is group 1 metal, while nitrogen is group.pdf                     Lithium is group 1 metal, while nitrogen is group.pdf
Lithium is group 1 metal, while nitrogen is group.pdfanjanaarts2014
 
there is some special character in ur question li.pdf
                     there is some special character in ur question li.pdf                     there is some special character in ur question li.pdf
there is some special character in ur question li.pdfanjanaarts2014
 
a.Times Interest Earned Ratio = EBIT interest ExpenseFor 2014.pdf
a.Times Interest Earned Ratio = EBIT  interest ExpenseFor 2014.pdfa.Times Interest Earned Ratio = EBIT  interest ExpenseFor 2014.pdf
a.Times Interest Earned Ratio = EBIT interest ExpenseFor 2014.pdfanjanaarts2014
 
45 yrs.Solution45 yrs..pdf
45 yrs.Solution45 yrs..pdf45 yrs.Solution45 yrs..pdf
45 yrs.Solution45 yrs..pdfanjanaarts2014
 
the bacteria isolated from the dead mouse is smooth (S) S. pneumonia.pdf
the bacteria isolated from the dead mouse is smooth (S) S. pneumonia.pdfthe bacteria isolated from the dead mouse is smooth (S) S. pneumonia.pdf
the bacteria isolated from the dead mouse is smooth (S) S. pneumonia.pdfanjanaarts2014
 

More from anjanaarts2014 (20)

A robust whistleblowing regime is now an integral part of governance.pdf
A robust whistleblowing regime is now an integral part of governance.pdfA robust whistleblowing regime is now an integral part of governance.pdf
A robust whistleblowing regime is now an integral part of governance.pdf
 
1. In higher parts of the reef, where the wave energy is high, the c.pdf
1. In higher parts of the reef, where the wave energy is high, the c.pdf1. In higher parts of the reef, where the wave energy is high, the c.pdf
1. In higher parts of the reef, where the wave energy is high, the c.pdf
 
a)dydx + 2yx = xI.F. = x^2solution iy .pdf
a)dydx + 2yx = xI.F. = x^2solution iy .pdfa)dydx + 2yx = xI.F. = x^2solution iy .pdf
a)dydx + 2yx = xI.F. = x^2solution iy .pdf
 
23.C. 1 in 424. B. Homozygous25. B. 5026.All females will be .pdf
23.C. 1 in 424. B. Homozygous25. B. 5026.All females will be .pdf23.C. 1 in 424. B. Homozygous25. B. 5026.All females will be .pdf
23.C. 1 in 424. B. Homozygous25. B. 5026.All females will be .pdf
 
A is correct. The ntp server 10.0.0.5 command is entered in Global C.pdf
A is correct. The ntp server 10.0.0.5 command is entered in Global C.pdfA is correct. The ntp server 10.0.0.5 command is entered in Global C.pdf
A is correct. The ntp server 10.0.0.5 command is entered in Global C.pdf
 
A. Gene expression.B. Transcription factor.C. Gene expression..pdf
A. Gene expression.B. Transcription factor.C. Gene expression..pdfA. Gene expression.B. Transcription factor.C. Gene expression..pdf
A. Gene expression.B. Transcription factor.C. Gene expression..pdf
 
All are capable to grow in lactose medium . In presence of lactose t.pdf
All are capable to grow in lactose medium . In presence of lactose t.pdfAll are capable to grow in lactose medium . In presence of lactose t.pdf
All are capable to grow in lactose medium . In presence of lactose t.pdf
 
1)The viruse which is the most dangerous threat.In DTI survey,72 of.pdf
1)The viruse which is the most dangerous threat.In DTI survey,72 of.pdf1)The viruse which is the most dangerous threat.In DTI survey,72 of.pdf
1)The viruse which is the most dangerous threat.In DTI survey,72 of.pdf
 
HClO3 + NaOH NaClO3 +H2O n(HClO3) = 0.10.04 = 4.pdf
                     HClO3 + NaOH  NaClO3 +H2O n(HClO3) = 0.10.04 = 4.pdf                     HClO3 + NaOH  NaClO3 +H2O n(HClO3) = 0.10.04 = 4.pdf
HClO3 + NaOH NaClO3 +H2O n(HClO3) = 0.10.04 = 4.pdf
 
The -OCl ion. .pdf
                     The -OCl ion.                                    .pdf                     The -OCl ion.                                    .pdf
The -OCl ion. .pdf
 
I have already answered it. Check. .pdf
                     I have already answered it. Check.               .pdf                     I have already answered it. Check.               .pdf
I have already answered it. Check. .pdf
 
Iodide is a strong nucleophile but a weak base, s.pdf
                     Iodide is a strong nucleophile but a weak base, s.pdf                     Iodide is a strong nucleophile but a weak base, s.pdf
Iodide is a strong nucleophile but a weak base, s.pdf
 
NaCl Its the coulombic interaction between Na.pdf
                     NaCl  Its the coulombic interaction between Na.pdf                     NaCl  Its the coulombic interaction between Na.pdf
NaCl Its the coulombic interaction between Na.pdf
 
Here Jupiter is the fifth planet from the Sun a.pdf
                     Here  Jupiter is the fifth planet from the Sun a.pdf                     Here  Jupiter is the fifth planet from the Sun a.pdf
Here Jupiter is the fifth planet from the Sun a.pdf
 
moles of H+ = 42.0 x 0.120 millimoles = 5.04 mill.pdf
                     moles of H+ = 42.0 x 0.120 millimoles = 5.04 mill.pdf                     moles of H+ = 42.0 x 0.120 millimoles = 5.04 mill.pdf
moles of H+ = 42.0 x 0.120 millimoles = 5.04 mill.pdf
 
Lithium is group 1 metal, while nitrogen is group.pdf
                     Lithium is group 1 metal, while nitrogen is group.pdf                     Lithium is group 1 metal, while nitrogen is group.pdf
Lithium is group 1 metal, while nitrogen is group.pdf
 
there is some special character in ur question li.pdf
                     there is some special character in ur question li.pdf                     there is some special character in ur question li.pdf
there is some special character in ur question li.pdf
 
a.Times Interest Earned Ratio = EBIT interest ExpenseFor 2014.pdf
a.Times Interest Earned Ratio = EBIT  interest ExpenseFor 2014.pdfa.Times Interest Earned Ratio = EBIT  interest ExpenseFor 2014.pdf
a.Times Interest Earned Ratio = EBIT interest ExpenseFor 2014.pdf
 
45 yrs.Solution45 yrs..pdf
45 yrs.Solution45 yrs..pdf45 yrs.Solution45 yrs..pdf
45 yrs.Solution45 yrs..pdf
 
the bacteria isolated from the dead mouse is smooth (S) S. pneumonia.pdf
the bacteria isolated from the dead mouse is smooth (S) S. pneumonia.pdfthe bacteria isolated from the dead mouse is smooth (S) S. pneumonia.pdf
the bacteria isolated from the dead mouse is smooth (S) S. pneumonia.pdf
 

Recently uploaded

8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...Nguyen Thanh Tu Collection
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint23600690
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 

Recently uploaded (20)

Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 

These are my codes. They are exactly similar to the above ones. Un.pdf

  • 1. //These are my codes. They are exactly similar to the above ones. Unless you missed some small sytax. They run perfectly fine. Which environment are you using to compile and run these programs? ColorPencil.java public class ColorPencil { private String color; private double length; private double thickness; public ColorPencil(String cpColor,double cpLength,double cpThickness) { color = cpColor; length = cpLength; thickness = cpThickness; } public ColorPencil() { color = "Black"; length = 6.0; thickness = 1.5; } public void setColor(String cpColor) { color = cpColor; } public void setLength(double cpLength) { length = cpLength; } public void setThickness(double cpThickness) {
  • 2. thickness = cpThickness; } public String getColor() { return color; } public double getLength() { return length; } public double getThickness() { return thickness; } public String newColor(String cpColor) { color = cpColor; return color; } public double newLength(double cpLength) { length = cpLength; return length; } public double newThickness(double cpThickness) { thickness = cpThickness; return thickness; }
  • 3. public static void main(String[] args) { // TODO Auto-generated method stub } } ColorPencilTest.java public class ColorPencilTest { public static void main(String[] args) { // TODO Auto-generated method stub ColorPencil change = new ColorPencil(); String origColor = change.getColor(); double origLength = change.getLength(); double origThickness = change.getThickness(); System.out.println("Original color of the pencil is "+origColor+" Original length of the pencil is "+origLength+" Original thickness of the pencil is "+origThickness); String color1 = "Pink"; change.setColor(color1); System.out.println("Color of the pencil is now "+color1); double length1 = 5.5; change.setLength(length1); System.out.println("Length of the pencil is now "+length1); double thickness1 = 0.7; change.setThickness(thickness1); System.out.println("Thickness of the pencil is now "+thickness1); } }
  • 4. Solution //These are my codes. They are exactly similar to the above ones. Unless you missed some small sytax. They run perfectly fine. Which environment are you using to compile and run these programs? ColorPencil.java public class ColorPencil { private String color; private double length; private double thickness; public ColorPencil(String cpColor,double cpLength,double cpThickness) { color = cpColor; length = cpLength; thickness = cpThickness; } public ColorPencil() { color = "Black"; length = 6.0; thickness = 1.5; } public void setColor(String cpColor) { color = cpColor; } public void setLength(double cpLength) { length = cpLength;
  • 5. } public void setThickness(double cpThickness) { thickness = cpThickness; } public String getColor() { return color; } public double getLength() { return length; } public double getThickness() { return thickness; } public String newColor(String cpColor) { color = cpColor; return color; } public double newLength(double cpLength) { length = cpLength; return length; } public double newThickness(double cpThickness) {
  • 6. thickness = cpThickness; return thickness; } public static void main(String[] args) { // TODO Auto-generated method stub } } ColorPencilTest.java public class ColorPencilTest { public static void main(String[] args) { // TODO Auto-generated method stub ColorPencil change = new ColorPencil(); String origColor = change.getColor(); double origLength = change.getLength(); double origThickness = change.getThickness(); System.out.println("Original color of the pencil is "+origColor+" Original length of the pencil is "+origLength+" Original thickness of the pencil is "+origThickness); String color1 = "Pink"; change.setColor(color1); System.out.println("Color of the pencil is now "+color1); double length1 = 5.5; change.setLength(length1); System.out.println("Length of the pencil is now "+length1); double thickness1 = 0.7;