SlideShare a Scribd company logo
1 of 2
Download to read offline
Create the variables, and methods needed for this class:
A DicePlayer is a class that represents the player in a Craps game. A DicePlayer is a data class.
The data we need to manage (the fields or class variables) are the players name and how much
money the player has to bet.
Methods are needed to manage this data.
Solution
import java.util.Scanner; // inporting required packages
class DicePlayer
{
private String name; // creating requried variables
private double cash;
Scanner sc=new Scanner(System.in); // scanner variable to take i/p's
public void setName()
{
System.out.println("Enter the name of the player ");
name=sc.next(); // taking player name
}
public void setCash ()
{
System.out.println("Give the amount on the hand ");
cash=sc.nextDouble(); // taking cash
}
public String getName()
{
return name; // getting name when needed
}
public double getCash()
{
return cash; // getting cash when needed
}
public boolean addCash()
{
double add;
System.out.println("Give the amount to add ");
add=sc.nextInt();
if (add>0) // checking the taken value is non-negative
{
cash=cash+add; // if yes add it to cash
return true;
}
else
return false; // else retrun false
}
public boolean subCash()
{
double sub;
System.out.println("Give the amount to sub ");
sub=sc.nextInt();
if (sub>0 && sub

More Related Content

Similar to Create the variables, and methods needed for this classA DicePlay.pdf

Quest 1 define a class batsman with the following specifications
Quest  1 define a class batsman with the following specificationsQuest  1 define a class batsman with the following specifications
Quest 1 define a class batsman with the following specificationsrajkumari873
 
Goal- Your goal in this assignment is to write a Java program that sim.pdf
Goal- Your goal in this assignment is to write a Java program that sim.pdfGoal- Your goal in this assignment is to write a Java program that sim.pdf
Goal- Your goal in this assignment is to write a Java program that sim.pdfaaicommunication34
 
import java.util.Random;defines the Stock class public class S.pdf
import java.util.Random;defines the Stock class public class S.pdfimport java.util.Random;defines the Stock class public class S.pdf
import java.util.Random;defines the Stock class public class S.pdfaquazac
 
Here is the game description- Here is the sample game- Goal- Your goal (1).pdf
Here is the game description- Here is the sample game- Goal- Your goal (1).pdfHere is the game description- Here is the sample game- Goal- Your goal (1).pdf
Here is the game description- Here is the sample game- Goal- Your goal (1).pdftrishulinoverseas1
 
Digital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Digital Mayflower - Data Pilgrimage with the Drupal Migrate ModuleDigital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Digital Mayflower - Data Pilgrimage with the Drupal Migrate ModuleErich Beyrent
 
Here is the game description- Here is the sample game- Here is the req.pdf
Here is the game description- Here is the sample game- Here is the req.pdfHere is the game description- Here is the sample game- Here is the req.pdf
Here is the game description- Here is the sample game- Here is the req.pdftrishulinoverseas1
 
Listing.javaimport java.util.Scanner;public class Listing {   .pdf
Listing.javaimport java.util.Scanner;public class Listing {   .pdfListing.javaimport java.util.Scanner;public class Listing {   .pdf
Listing.javaimport java.util.Scanner;public class Listing {   .pdfAnkitchhabra28
 
Write a class Runner that contains the following data members.docx
Write a class Runner that contains the following data members.docxWrite a class Runner that contains the following data members.docx
Write a class Runner that contains the following data members.docxzahid javed
 
Thanks so much for your help. Review the GameService class. Noti.pdf
Thanks so much for your help. Review the GameService class. Noti.pdfThanks so much for your help. Review the GameService class. Noti.pdf
Thanks so much for your help. Review the GameService class. Noti.pdfadwitanokiastore
 
PHP record- with all programs and output
PHP record- with all programs and outputPHP record- with all programs and output
PHP record- with all programs and outputKavithaK23
 
Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdfWrite a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdfrozakashif85
 

Similar to Create the variables, and methods needed for this classA DicePlay.pdf (16)

Quest 1 define a class batsman with the following specifications
Quest  1 define a class batsman with the following specificationsQuest  1 define a class batsman with the following specifications
Quest 1 define a class batsman with the following specifications
 
Es6 overview
Es6 overviewEs6 overview
Es6 overview
 
Goal- Your goal in this assignment is to write a Java program that sim.pdf
Goal- Your goal in this assignment is to write a Java program that sim.pdfGoal- Your goal in this assignment is to write a Java program that sim.pdf
Goal- Your goal in this assignment is to write a Java program that sim.pdf
 
import java.util.Random;defines the Stock class public class S.pdf
import java.util.Random;defines the Stock class public class S.pdfimport java.util.Random;defines the Stock class public class S.pdf
import java.util.Random;defines the Stock class public class S.pdf
 
Here is the game description- Here is the sample game- Goal- Your goal (1).pdf
Here is the game description- Here is the sample game- Goal- Your goal (1).pdfHere is the game description- Here is the sample game- Goal- Your goal (1).pdf
Here is the game description- Here is the sample game- Goal- Your goal (1).pdf
 
Drupal7 dbtng
Drupal7  dbtngDrupal7  dbtng
Drupal7 dbtng
 
Digital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Digital Mayflower - Data Pilgrimage with the Drupal Migrate ModuleDigital Mayflower - Data Pilgrimage with the Drupal Migrate Module
Digital Mayflower - Data Pilgrimage with the Drupal Migrate Module
 
PHP OOP
PHP OOPPHP OOP
PHP OOP
 
Here is the game description- Here is the sample game- Here is the req.pdf
Here is the game description- Here is the sample game- Here is the req.pdfHere is the game description- Here is the sample game- Here is the req.pdf
Here is the game description- Here is the sample game- Here is the req.pdf
 
Listing.javaimport java.util.Scanner;public class Listing {   .pdf
Listing.javaimport java.util.Scanner;public class Listing {   .pdfListing.javaimport java.util.Scanner;public class Listing {   .pdf
Listing.javaimport java.util.Scanner;public class Listing {   .pdf
 
Write a class Runner that contains the following data members.docx
Write a class Runner that contains the following data members.docxWrite a class Runner that contains the following data members.docx
Write a class Runner that contains the following data members.docx
 
Thanks so much for your help. Review the GameService class. Noti.pdf
Thanks so much for your help. Review the GameService class. Noti.pdfThanks so much for your help. Review the GameService class. Noti.pdf
Thanks so much for your help. Review the GameService class. Noti.pdf
 
Drupal 8 database api
Drupal 8 database apiDrupal 8 database api
Drupal 8 database api
 
Intermediate PHP
Intermediate PHPIntermediate PHP
Intermediate PHP
 
PHP record- with all programs and output
PHP record- with all programs and outputPHP record- with all programs and output
PHP record- with all programs and output
 
Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdfWrite a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
 

More from poblettesedanoree498

Give examples of two zoonotic diseases. Explain how these zoonotic d.pdf
Give examples of two zoonotic diseases. Explain how these zoonotic d.pdfGive examples of two zoonotic diseases. Explain how these zoonotic d.pdf
Give examples of two zoonotic diseases. Explain how these zoonotic d.pdfpoblettesedanoree498
 
Describe different flow control valves with figures. Include referenc.pdf
Describe different flow control valves with figures. Include referenc.pdfDescribe different flow control valves with figures. Include referenc.pdf
Describe different flow control valves with figures. Include referenc.pdfpoblettesedanoree498
 
Consider a sample with data values of 10, 20, 12, 17, and 16.Compute.pdf
Consider a sample with data values of 10, 20, 12, 17, and 16.Compute.pdfConsider a sample with data values of 10, 20, 12, 17, and 16.Compute.pdf
Consider a sample with data values of 10, 20, 12, 17, and 16.Compute.pdfpoblettesedanoree498
 
Compare and contrast transmit and receive diversity. Describe how ea.pdf
Compare and contrast transmit and receive diversity. Describe how ea.pdfCompare and contrast transmit and receive diversity. Describe how ea.pdf
Compare and contrast transmit and receive diversity. Describe how ea.pdfpoblettesedanoree498
 
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfpoblettesedanoree498
 
Blood in the femoral artery will flow into what artery next Bl.pdf
Blood in the femoral artery will flow into what artery next Bl.pdfBlood in the femoral artery will flow into what artery next Bl.pdf
Blood in the femoral artery will flow into what artery next Bl.pdfpoblettesedanoree498
 
Assume that 96 of ticket holders show up for an airline flight. If .pdf
Assume that 96 of ticket holders show up for an airline flight. If .pdfAssume that 96 of ticket holders show up for an airline flight. If .pdf
Assume that 96 of ticket holders show up for an airline flight. If .pdfpoblettesedanoree498
 
Although some male crab spiders find and mate with adult female spide.pdf
Although some male crab spiders find and mate with adult female spide.pdfAlthough some male crab spiders find and mate with adult female spide.pdf
Although some male crab spiders find and mate with adult female spide.pdfpoblettesedanoree498
 
7. At October 1, Smithson Enterprises reported owners equity of $.pdf
7. At October 1, Smithson Enterprises reported owners equity of $.pdf7. At October 1, Smithson Enterprises reported owners equity of $.pdf
7. At October 1, Smithson Enterprises reported owners equity of $.pdfpoblettesedanoree498
 
5. A repeated measures analysis of variane shows, F(4,20)=14.56. How.pdf
5. A repeated measures analysis of variane shows, F(4,20)=14.56. How.pdf5. A repeated measures analysis of variane shows, F(4,20)=14.56. How.pdf
5. A repeated measures analysis of variane shows, F(4,20)=14.56. How.pdfpoblettesedanoree498
 
–PLS write program in c++ thanxLinked List Sorting and Reversing.pdf
–PLS write program in c++ thanxLinked List Sorting and Reversing.pdf–PLS write program in c++ thanxLinked List Sorting and Reversing.pdf
–PLS write program in c++ thanxLinked List Sorting and Reversing.pdfpoblettesedanoree498
 
Write a Java program that calculates the distance between two points.pdf
Write a Java program that calculates the distance between two points.pdfWrite a Java program that calculates the distance between two points.pdf
Write a Java program that calculates the distance between two points.pdfpoblettesedanoree498
 
Which of the following light waves has the most amount of energyH.pdf
Which of the following light waves has the most amount of energyH.pdfWhich of the following light waves has the most amount of energyH.pdf
Which of the following light waves has the most amount of energyH.pdfpoblettesedanoree498
 
What is the wobble position What is the consequence of its pres.pdf
What is the wobble position What is the consequence of its pres.pdfWhat is the wobble position What is the consequence of its pres.pdf
What is the wobble position What is the consequence of its pres.pdfpoblettesedanoree498
 
What is an advantage of having homologous chromosomes (compared to h.pdf
What is an advantage of having homologous chromosomes (compared to h.pdfWhat is an advantage of having homologous chromosomes (compared to h.pdf
What is an advantage of having homologous chromosomes (compared to h.pdfpoblettesedanoree498
 
What are oncogenic viruses Which of the following groups of viruses.pdf
What are oncogenic viruses  Which of the following groups of viruses.pdfWhat are oncogenic viruses  Which of the following groups of viruses.pdf
What are oncogenic viruses Which of the following groups of viruses.pdfpoblettesedanoree498
 
Unlike the biological species concept, the morphospecies concept rel.pdf
Unlike the biological species concept, the morphospecies concept rel.pdfUnlike the biological species concept, the morphospecies concept rel.pdf
Unlike the biological species concept, the morphospecies concept rel.pdfpoblettesedanoree498
 
1.) Which macronutrient do we consume in large amounts, but which we.pdf
1.) Which macronutrient do we consume in large amounts, but which we.pdf1.) Which macronutrient do we consume in large amounts, but which we.pdf
1.) Which macronutrient do we consume in large amounts, but which we.pdfpoblettesedanoree498
 
11.1.2 Entered Answer Preview 28 28 128 128 At least one of the an.pdf
11.1.2 Entered Answer Preview 28 28 128 128 At least one of the an.pdf11.1.2 Entered Answer Preview 28 28 128 128 At least one of the an.pdf
11.1.2 Entered Answer Preview 28 28 128 128 At least one of the an.pdfpoblettesedanoree498
 
The systemic circuit delivers oxygenated blood to and returns blood t.pdf
The systemic circuit delivers oxygenated blood to and returns blood t.pdfThe systemic circuit delivers oxygenated blood to and returns blood t.pdf
The systemic circuit delivers oxygenated blood to and returns blood t.pdfpoblettesedanoree498
 

More from poblettesedanoree498 (20)

Give examples of two zoonotic diseases. Explain how these zoonotic d.pdf
Give examples of two zoonotic diseases. Explain how these zoonotic d.pdfGive examples of two zoonotic diseases. Explain how these zoonotic d.pdf
Give examples of two zoonotic diseases. Explain how these zoonotic d.pdf
 
Describe different flow control valves with figures. Include referenc.pdf
Describe different flow control valves with figures. Include referenc.pdfDescribe different flow control valves with figures. Include referenc.pdf
Describe different flow control valves with figures. Include referenc.pdf
 
Consider a sample with data values of 10, 20, 12, 17, and 16.Compute.pdf
Consider a sample with data values of 10, 20, 12, 17, and 16.Compute.pdfConsider a sample with data values of 10, 20, 12, 17, and 16.Compute.pdf
Consider a sample with data values of 10, 20, 12, 17, and 16.Compute.pdf
 
Compare and contrast transmit and receive diversity. Describe how ea.pdf
Compare and contrast transmit and receive diversity. Describe how ea.pdfCompare and contrast transmit and receive diversity. Describe how ea.pdf
Compare and contrast transmit and receive diversity. Describe how ea.pdf
 
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
 
Blood in the femoral artery will flow into what artery next Bl.pdf
Blood in the femoral artery will flow into what artery next Bl.pdfBlood in the femoral artery will flow into what artery next Bl.pdf
Blood in the femoral artery will flow into what artery next Bl.pdf
 
Assume that 96 of ticket holders show up for an airline flight. If .pdf
Assume that 96 of ticket holders show up for an airline flight. If .pdfAssume that 96 of ticket holders show up for an airline flight. If .pdf
Assume that 96 of ticket holders show up for an airline flight. If .pdf
 
Although some male crab spiders find and mate with adult female spide.pdf
Although some male crab spiders find and mate with adult female spide.pdfAlthough some male crab spiders find and mate with adult female spide.pdf
Although some male crab spiders find and mate with adult female spide.pdf
 
7. At October 1, Smithson Enterprises reported owners equity of $.pdf
7. At October 1, Smithson Enterprises reported owners equity of $.pdf7. At October 1, Smithson Enterprises reported owners equity of $.pdf
7. At October 1, Smithson Enterprises reported owners equity of $.pdf
 
5. A repeated measures analysis of variane shows, F(4,20)=14.56. How.pdf
5. A repeated measures analysis of variane shows, F(4,20)=14.56. How.pdf5. A repeated measures analysis of variane shows, F(4,20)=14.56. How.pdf
5. A repeated measures analysis of variane shows, F(4,20)=14.56. How.pdf
 
–PLS write program in c++ thanxLinked List Sorting and Reversing.pdf
–PLS write program in c++ thanxLinked List Sorting and Reversing.pdf–PLS write program in c++ thanxLinked List Sorting and Reversing.pdf
–PLS write program in c++ thanxLinked List Sorting and Reversing.pdf
 
Write a Java program that calculates the distance between two points.pdf
Write a Java program that calculates the distance between two points.pdfWrite a Java program that calculates the distance between two points.pdf
Write a Java program that calculates the distance between two points.pdf
 
Which of the following light waves has the most amount of energyH.pdf
Which of the following light waves has the most amount of energyH.pdfWhich of the following light waves has the most amount of energyH.pdf
Which of the following light waves has the most amount of energyH.pdf
 
What is the wobble position What is the consequence of its pres.pdf
What is the wobble position What is the consequence of its pres.pdfWhat is the wobble position What is the consequence of its pres.pdf
What is the wobble position What is the consequence of its pres.pdf
 
What is an advantage of having homologous chromosomes (compared to h.pdf
What is an advantage of having homologous chromosomes (compared to h.pdfWhat is an advantage of having homologous chromosomes (compared to h.pdf
What is an advantage of having homologous chromosomes (compared to h.pdf
 
What are oncogenic viruses Which of the following groups of viruses.pdf
What are oncogenic viruses  Which of the following groups of viruses.pdfWhat are oncogenic viruses  Which of the following groups of viruses.pdf
What are oncogenic viruses Which of the following groups of viruses.pdf
 
Unlike the biological species concept, the morphospecies concept rel.pdf
Unlike the biological species concept, the morphospecies concept rel.pdfUnlike the biological species concept, the morphospecies concept rel.pdf
Unlike the biological species concept, the morphospecies concept rel.pdf
 
1.) Which macronutrient do we consume in large amounts, but which we.pdf
1.) Which macronutrient do we consume in large amounts, but which we.pdf1.) Which macronutrient do we consume in large amounts, but which we.pdf
1.) Which macronutrient do we consume in large amounts, but which we.pdf
 
11.1.2 Entered Answer Preview 28 28 128 128 At least one of the an.pdf
11.1.2 Entered Answer Preview 28 28 128 128 At least one of the an.pdf11.1.2 Entered Answer Preview 28 28 128 128 At least one of the an.pdf
11.1.2 Entered Answer Preview 28 28 128 128 At least one of the an.pdf
 
The systemic circuit delivers oxygenated blood to and returns blood t.pdf
The systemic circuit delivers oxygenated blood to and returns blood t.pdfThe systemic circuit delivers oxygenated blood to and returns blood t.pdf
The systemic circuit delivers oxygenated blood to and returns blood t.pdf
 

Recently uploaded

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
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
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
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
 
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
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
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
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 

Recently uploaded (20)

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
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Ă...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
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
 
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
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
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
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 

Create the variables, and methods needed for this classA DicePlay.pdf

  • 1. Create the variables, and methods needed for this class: A DicePlayer is a class that represents the player in a Craps game. A DicePlayer is a data class. The data we need to manage (the fields or class variables) are the players name and how much money the player has to bet. Methods are needed to manage this data. Solution import java.util.Scanner; // inporting required packages class DicePlayer { private String name; // creating requried variables private double cash; Scanner sc=new Scanner(System.in); // scanner variable to take i/p's public void setName() { System.out.println("Enter the name of the player "); name=sc.next(); // taking player name } public void setCash () { System.out.println("Give the amount on the hand "); cash=sc.nextDouble(); // taking cash } public String getName() { return name; // getting name when needed } public double getCash() { return cash; // getting cash when needed } public boolean addCash() { double add;
  • 2. System.out.println("Give the amount to add "); add=sc.nextInt(); if (add>0) // checking the taken value is non-negative { cash=cash+add; // if yes add it to cash return true; } else return false; // else retrun false } public boolean subCash() { double sub; System.out.println("Give the amount to sub "); sub=sc.nextInt(); if (sub>0 && sub