SlideShare a Scribd company logo
1 of 3
Download to read offline
Need help finding the error in my code. Wherever there's a "player." something netbeans
shows an error saying "cannot find symbol".
import java.util.Scanner;
public class DicePlayer {
private boolean player;
private String name;
private double cash;
Scanner scnr=new Scanner(System.in);
public void setName()
{
System.out.println("Enter the name of the player ");
name=scnr.next();
}
public void setCash ()
{
System.out.println("Give the amount on the hand ");
cash=scnr.nextDouble();
}
public String getName()
{
return name;
}
public double getCash()
{
return cash;
}
public boolean addCash()
{
double add;
System.out.println("Give the amount to add ");
add=scnr.nextInt();
if (add>0)
{
cash=cash+add;
return true;
}
else
return false;
}
public boolean subCash()
{
double sub;
System.out.println("Give the amount to sub ");
sub=scnr.nextInt();
if (sub>0 && sub
Solution
I have spotted following errorsin your code:
//private boolean player; // as you are not using this variable , so, i have commented it.
private String name;
private double cash;
Scanner scnr=new Scanner(System.in);
public void setName(String name)
{
System.out.println("Enter the name of the player ");
// name=scnr.next();
this.name=name;
}
public void setCash (int cash)
{
System.out.println("Give the amount on the hand ");
//cash=scnr.nextDouble();
this.cash=cash;
}
public String getName()
{
return name;
}
public double getCash()
{
return cash;
}
public boolean addCash(double a)
{
double add;
System.out.println("Give the amount to add ");
//add=scnr.nextInt();
add=a;
if (add>0)
{
cash=cash+add;
return true;
}
else
return false;
}
public boolean subCash(double s)
{
double sub=s;
System.out.println("Give the amount to sub ");
// sub=scnr.nextInt();
if (sub>0 && sub

More Related Content

Similar to Need help finding the error in my code. Wherever theres a player.pdf

In your Person classAdd a constant field to store the current yea.pdf
In your Person classAdd a constant field to store the current yea.pdfIn your Person classAdd a constant field to store the current yea.pdf
In your Person classAdd a constant field to store the current yea.pdfarihanthtextiles
 
Bank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdfBank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdfizabellejaeden956
 
There is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfThere is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfaashienterprisesuk
 
I received answers to 2 App requests and paid. The JAVA Apps are not.docx
I received answers to 2 App requests and paid. The JAVA Apps are not.docxI received answers to 2 App requests and paid. The JAVA Apps are not.docx
I received answers to 2 App requests and paid. The JAVA Apps are not.docxwalthamcoretta
 
Please observe the the code and validations of user inputs.import .pdf
Please observe the the code and validations of user inputs.import .pdfPlease observe the the code and validations of user inputs.import .pdf
Please observe the the code and validations of user inputs.import .pdfapexjaipur
 
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdfJAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdfcalderoncasto9163
 
I dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfI dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfarchanaemporium
 
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdfRepeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdfarracollection
 
I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfrajeshjangid1865
 

Similar to Need help finding the error in my code. Wherever theres a player.pdf (9)

In your Person classAdd a constant field to store the current yea.pdf
In your Person classAdd a constant field to store the current yea.pdfIn your Person classAdd a constant field to store the current yea.pdf
In your Person classAdd a constant field to store the current yea.pdf
 
Bank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdfBank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdf
 
There is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdfThere is something wrong with my program-- (once I do a for view all t.pdf
There is something wrong with my program-- (once I do a for view all t.pdf
 
I received answers to 2 App requests and paid. The JAVA Apps are not.docx
I received answers to 2 App requests and paid. The JAVA Apps are not.docxI received answers to 2 App requests and paid. The JAVA Apps are not.docx
I received answers to 2 App requests and paid. The JAVA Apps are not.docx
 
Please observe the the code and validations of user inputs.import .pdf
Please observe the the code and validations of user inputs.import .pdfPlease observe the the code and validations of user inputs.import .pdf
Please observe the the code and validations of user inputs.import .pdf
 
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdfJAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
 
I dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfI dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdf
 
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdfRepeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
 
I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdf
 

More from arihanthtoysandgifts

Match the following cell structures in the Amoeba to their definition.pdf
Match the following cell structures in the Amoeba to their definition.pdfMatch the following cell structures in the Amoeba to their definition.pdf
Match the following cell structures in the Amoeba to their definition.pdfarihanthtoysandgifts
 
Let D P2(R) P1(R) defined by D(p) = p . Where p is the deriva.pdf
Let D  P2(R)  P1(R) defined by D(p) = p . Where p is the deriva.pdfLet D  P2(R)  P1(R) defined by D(p) = p . Where p is the deriva.pdf
Let D P2(R) P1(R) defined by D(p) = p . Where p is the deriva.pdfarihanthtoysandgifts
 
Islam and Supply-Side EconomicsSupply-side economics has a long hi.pdf
Islam and Supply-Side EconomicsSupply-side economics has a long hi.pdfIslam and Supply-Side EconomicsSupply-side economics has a long hi.pdf
Islam and Supply-Side EconomicsSupply-side economics has a long hi.pdfarihanthtoysandgifts
 
Is there a vertex common to every longest path in the following graph.pdf
Is there a vertex common to every longest path in the following graph.pdfIs there a vertex common to every longest path in the following graph.pdf
Is there a vertex common to every longest path in the following graph.pdfarihanthtoysandgifts
 
Increasingly there is political discussion in carbon dioxide as well.pdf
Increasingly there is political discussion in carbon dioxide as well.pdfIncreasingly there is political discussion in carbon dioxide as well.pdf
Increasingly there is political discussion in carbon dioxide as well.pdfarihanthtoysandgifts
 
In the following diagram, identify the labeled bony landmarks and ope.pdf
In the following diagram, identify the labeled bony landmarks and ope.pdfIn the following diagram, identify the labeled bony landmarks and ope.pdf
In the following diagram, identify the labeled bony landmarks and ope.pdfarihanthtoysandgifts
 
In January 2017, Bramble Corp., a newly formed company, issued 10400.pdf
In January 2017, Bramble Corp., a newly formed company, issued 10400.pdfIn January 2017, Bramble Corp., a newly formed company, issued 10400.pdf
In January 2017, Bramble Corp., a newly formed company, issued 10400.pdfarihanthtoysandgifts
 
How do humans detect color Considering your answer to this question.pdf
How do humans detect color Considering your answer to this question.pdfHow do humans detect color Considering your answer to this question.pdf
How do humans detect color Considering your answer to this question.pdfarihanthtoysandgifts
 
Identify the unique characteristics of auditing professionSoluti.pdf
Identify the unique characteristics of auditing professionSoluti.pdfIdentify the unique characteristics of auditing professionSoluti.pdf
Identify the unique characteristics of auditing professionSoluti.pdfarihanthtoysandgifts
 
Hemophilia is a recessive trait. The dominant trait is normal blood d.pdf
Hemophilia is a recessive trait. The dominant trait is normal blood d.pdfHemophilia is a recessive trait. The dominant trait is normal blood d.pdf
Hemophilia is a recessive trait. The dominant trait is normal blood d.pdfarihanthtoysandgifts
 
Explain the purpose of the Medium Access Control (MAC) timing paramet.pdf
Explain the purpose of the Medium Access Control (MAC) timing paramet.pdfExplain the purpose of the Medium Access Control (MAC) timing paramet.pdf
Explain the purpose of the Medium Access Control (MAC) timing paramet.pdfarihanthtoysandgifts
 
find the payment necessary to amortize 8 loan of $1500 for 19 compo.pdf
find the payment necessary to amortize 8 loan of $1500 for 19 compo.pdffind the payment necessary to amortize 8 loan of $1500 for 19 compo.pdf
find the payment necessary to amortize 8 loan of $1500 for 19 compo.pdfarihanthtoysandgifts
 
explain why HCO3- levels can be calculated from pH and pCO2 levels.pdf
explain why HCO3- levels can be calculated from pH and pCO2 levels.pdfexplain why HCO3- levels can be calculated from pH and pCO2 levels.pdf
explain why HCO3- levels can be calculated from pH and pCO2 levels.pdfarihanthtoysandgifts
 
Describe the arrangement of neurons in the primary motor cortexS.pdf
Describe the arrangement of neurons in the primary motor cortexS.pdfDescribe the arrangement of neurons in the primary motor cortexS.pdf
Describe the arrangement of neurons in the primary motor cortexS.pdfarihanthtoysandgifts
 
Cell Image Cell type eukaryotic cell t prokaryotic cell Solution.pdf
Cell Image Cell type eukaryotic cell t prokaryotic cell Solution.pdfCell Image Cell type eukaryotic cell t prokaryotic cell Solution.pdf
Cell Image Cell type eukaryotic cell t prokaryotic cell Solution.pdfarihanthtoysandgifts
 
An inbred line of Drosophila will drink sugar water to which small am.pdf
An inbred line of Drosophila will drink sugar water to which small am.pdfAn inbred line of Drosophila will drink sugar water to which small am.pdf
An inbred line of Drosophila will drink sugar water to which small am.pdfarihanthtoysandgifts
 
ACC312 Federal TaxationTax avoidanceTax evasion questions1. The.pdf
ACC312 Federal TaxationTax avoidanceTax evasion questions1. The.pdfACC312 Federal TaxationTax avoidanceTax evasion questions1. The.pdf
ACC312 Federal TaxationTax avoidanceTax evasion questions1. The.pdfarihanthtoysandgifts
 
a total of 100 students are taking a history exam. each student is r.pdf
a total of 100 students are taking a history exam. each student is r.pdfa total of 100 students are taking a history exam. each student is r.pdf
a total of 100 students are taking a history exam. each student is r.pdfarihanthtoysandgifts
 
A case study of a young man with a viral infection In the late winte.pdf
A case study of a young man with a viral infection  In the late winte.pdfA case study of a young man with a viral infection  In the late winte.pdf
A case study of a young man with a viral infection In the late winte.pdfarihanthtoysandgifts
 
A child drops a ball from a bridge. The ball strikes the water under.pdf
A child drops a ball from a bridge. The ball strikes the water under.pdfA child drops a ball from a bridge. The ball strikes the water under.pdf
A child drops a ball from a bridge. The ball strikes the water under.pdfarihanthtoysandgifts
 

More from arihanthtoysandgifts (20)

Match the following cell structures in the Amoeba to their definition.pdf
Match the following cell structures in the Amoeba to their definition.pdfMatch the following cell structures in the Amoeba to their definition.pdf
Match the following cell structures in the Amoeba to their definition.pdf
 
Let D P2(R) P1(R) defined by D(p) = p . Where p is the deriva.pdf
Let D  P2(R)  P1(R) defined by D(p) = p . Where p is the deriva.pdfLet D  P2(R)  P1(R) defined by D(p) = p . Where p is the deriva.pdf
Let D P2(R) P1(R) defined by D(p) = p . Where p is the deriva.pdf
 
Islam and Supply-Side EconomicsSupply-side economics has a long hi.pdf
Islam and Supply-Side EconomicsSupply-side economics has a long hi.pdfIslam and Supply-Side EconomicsSupply-side economics has a long hi.pdf
Islam and Supply-Side EconomicsSupply-side economics has a long hi.pdf
 
Is there a vertex common to every longest path in the following graph.pdf
Is there a vertex common to every longest path in the following graph.pdfIs there a vertex common to every longest path in the following graph.pdf
Is there a vertex common to every longest path in the following graph.pdf
 
Increasingly there is political discussion in carbon dioxide as well.pdf
Increasingly there is political discussion in carbon dioxide as well.pdfIncreasingly there is political discussion in carbon dioxide as well.pdf
Increasingly there is political discussion in carbon dioxide as well.pdf
 
In the following diagram, identify the labeled bony landmarks and ope.pdf
In the following diagram, identify the labeled bony landmarks and ope.pdfIn the following diagram, identify the labeled bony landmarks and ope.pdf
In the following diagram, identify the labeled bony landmarks and ope.pdf
 
In January 2017, Bramble Corp., a newly formed company, issued 10400.pdf
In January 2017, Bramble Corp., a newly formed company, issued 10400.pdfIn January 2017, Bramble Corp., a newly formed company, issued 10400.pdf
In January 2017, Bramble Corp., a newly formed company, issued 10400.pdf
 
How do humans detect color Considering your answer to this question.pdf
How do humans detect color Considering your answer to this question.pdfHow do humans detect color Considering your answer to this question.pdf
How do humans detect color Considering your answer to this question.pdf
 
Identify the unique characteristics of auditing professionSoluti.pdf
Identify the unique characteristics of auditing professionSoluti.pdfIdentify the unique characteristics of auditing professionSoluti.pdf
Identify the unique characteristics of auditing professionSoluti.pdf
 
Hemophilia is a recessive trait. The dominant trait is normal blood d.pdf
Hemophilia is a recessive trait. The dominant trait is normal blood d.pdfHemophilia is a recessive trait. The dominant trait is normal blood d.pdf
Hemophilia is a recessive trait. The dominant trait is normal blood d.pdf
 
Explain the purpose of the Medium Access Control (MAC) timing paramet.pdf
Explain the purpose of the Medium Access Control (MAC) timing paramet.pdfExplain the purpose of the Medium Access Control (MAC) timing paramet.pdf
Explain the purpose of the Medium Access Control (MAC) timing paramet.pdf
 
find the payment necessary to amortize 8 loan of $1500 for 19 compo.pdf
find the payment necessary to amortize 8 loan of $1500 for 19 compo.pdffind the payment necessary to amortize 8 loan of $1500 for 19 compo.pdf
find the payment necessary to amortize 8 loan of $1500 for 19 compo.pdf
 
explain why HCO3- levels can be calculated from pH and pCO2 levels.pdf
explain why HCO3- levels can be calculated from pH and pCO2 levels.pdfexplain why HCO3- levels can be calculated from pH and pCO2 levels.pdf
explain why HCO3- levels can be calculated from pH and pCO2 levels.pdf
 
Describe the arrangement of neurons in the primary motor cortexS.pdf
Describe the arrangement of neurons in the primary motor cortexS.pdfDescribe the arrangement of neurons in the primary motor cortexS.pdf
Describe the arrangement of neurons in the primary motor cortexS.pdf
 
Cell Image Cell type eukaryotic cell t prokaryotic cell Solution.pdf
Cell Image Cell type eukaryotic cell t prokaryotic cell Solution.pdfCell Image Cell type eukaryotic cell t prokaryotic cell Solution.pdf
Cell Image Cell type eukaryotic cell t prokaryotic cell Solution.pdf
 
An inbred line of Drosophila will drink sugar water to which small am.pdf
An inbred line of Drosophila will drink sugar water to which small am.pdfAn inbred line of Drosophila will drink sugar water to which small am.pdf
An inbred line of Drosophila will drink sugar water to which small am.pdf
 
ACC312 Federal TaxationTax avoidanceTax evasion questions1. The.pdf
ACC312 Federal TaxationTax avoidanceTax evasion questions1. The.pdfACC312 Federal TaxationTax avoidanceTax evasion questions1. The.pdf
ACC312 Federal TaxationTax avoidanceTax evasion questions1. The.pdf
 
a total of 100 students are taking a history exam. each student is r.pdf
a total of 100 students are taking a history exam. each student is r.pdfa total of 100 students are taking a history exam. each student is r.pdf
a total of 100 students are taking a history exam. each student is r.pdf
 
A case study of a young man with a viral infection In the late winte.pdf
A case study of a young man with a viral infection  In the late winte.pdfA case study of a young man with a viral infection  In the late winte.pdf
A case study of a young man with a viral infection In the late winte.pdf
 
A child drops a ball from a bridge. The ball strikes the water under.pdf
A child drops a ball from a bridge. The ball strikes the water under.pdfA child drops a ball from a bridge. The ball strikes the water under.pdf
A child drops a ball from a bridge. The ball strikes the water under.pdf
 

Recently uploaded

PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code ExamplesPeter Brusilovsky
 
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
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
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
 
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
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxCeline George
 
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
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 

Recently uploaded (20)

PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
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
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
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
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
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
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
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
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 

Need help finding the error in my code. Wherever theres a player.pdf

  • 1. Need help finding the error in my code. Wherever there's a "player." something netbeans shows an error saying "cannot find symbol". import java.util.Scanner; public class DicePlayer { private boolean player; private String name; private double cash; Scanner scnr=new Scanner(System.in); public void setName() { System.out.println("Enter the name of the player "); name=scnr.next(); } public void setCash () { System.out.println("Give the amount on the hand "); cash=scnr.nextDouble(); } public String getName() { return name; } public double getCash() { return cash; } public boolean addCash() { double add; System.out.println("Give the amount to add "); add=scnr.nextInt(); if (add>0)
  • 2. { cash=cash+add; return true; } else return false; } public boolean subCash() { double sub; System.out.println("Give the amount to sub "); sub=scnr.nextInt(); if (sub>0 && sub Solution I have spotted following errorsin your code: //private boolean player; // as you are not using this variable , so, i have commented it. private String name; private double cash; Scanner scnr=new Scanner(System.in); public void setName(String name) { System.out.println("Enter the name of the player "); // name=scnr.next(); this.name=name; } public void setCash (int cash) { System.out.println("Give the amount on the hand "); //cash=scnr.nextDouble(); this.cash=cash; } public String getName() { return name; }
  • 3. public double getCash() { return cash; } public boolean addCash(double a) { double add; System.out.println("Give the amount to add "); //add=scnr.nextInt(); add=a; if (add>0) { cash=cash+add; return true; } else return false; } public boolean subCash(double s) { double sub=s; System.out.println("Give the amount to sub "); // sub=scnr.nextInt(); if (sub>0 && sub