SlideShare a Scribd company logo
Hi, Please find mu code:
import java.util.Random;
public class SuperDie {
private int sides;
private Random rand;
public SuperDie(){ // Default constructor
sides = 6;
rand = new Random();
}
// Constructor that lets user define number of sides n.
public SuperDie(int n){
sides = n;
rand = new Random();
}
// Constructor that lets user define number of sides n AND provide their own Random object.
public SuperDie(int n, Random r){
sides = n;
rand = r;
}
public int getNumSides(){
return sides;
}
public void setNumSides(int n){
sides = n;
}
public int roll(){
return rand.nextInt(sides)+1;
}
}
import java.util.*;
class MainDie {
public static void main (String[] args) {
int value, sides;
Random rand = new Random();
SuperDie d1 = new SuperDie();
SuperDie d2 = new SuperDie(20);
SuperDie d3 = new SuperDie(10,rand);
value = d1.roll();
System.out.println ("die1 = " + value);
value = d2.roll();
System.out.println ("die2 = " + value);
value = d3.roll();
System.out.println ("die3 = " + value);
d1.setNumSides(8);
System.out.println ("die1 = " + d1.getNumSides());
}
}
/*
Sample Output:
die1 = 5
die2 = 5
die3 = 2
die1 = 8
*/
Solution
Hi, Please find mu code:
import java.util.Random;
public class SuperDie {
private int sides;
private Random rand;
public SuperDie(){ // Default constructor
sides = 6;
rand = new Random();
}
// Constructor that lets user define number of sides n.
public SuperDie(int n){
sides = n;
rand = new Random();
}
// Constructor that lets user define number of sides n AND provide their own Random object.
public SuperDie(int n, Random r){
sides = n;
rand = r;
}
public int getNumSides(){
return sides;
}
public void setNumSides(int n){
sides = n;
}
public int roll(){
return rand.nextInt(sides)+1;
}
}
import java.util.*;
class MainDie {
public static void main (String[] args) {
int value, sides;
Random rand = new Random();
SuperDie d1 = new SuperDie();
SuperDie d2 = new SuperDie(20);
SuperDie d3 = new SuperDie(10,rand);
value = d1.roll();
System.out.println ("die1 = " + value);
value = d2.roll();
System.out.println ("die2 = " + value);
value = d3.roll();
System.out.println ("die3 = " + value);
d1.setNumSides(8);
System.out.println ("die1 = " + d1.getNumSides());
}
}
/*
Sample Output:
die1 = 5
die2 = 5
die3 = 2
die1 = 8
*/

More Related Content

Similar to Hi, Please find mu codeimport java.util.Random;public class Sup.pdf

Android RenderScript
Android RenderScriptAndroid RenderScript
Android RenderScript
Jungsoo Nam
 
Kotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime PerformanceKotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime Performance
intelliyole
 
Please help me make a UML for Java! Look at the code below and make a.docx
Please help me make a UML for Java! Look at the code below and make a.docxPlease help me make a UML for Java! Look at the code below and make a.docx
Please help me make a UML for Java! Look at the code below and make a.docx
JakeT2gGrayp
 
Using Java, please write the program for the following prompt in the.pdf
Using Java, please write the program for the following prompt in the.pdfUsing Java, please write the program for the following prompt in the.pdf
Using Java, please write the program for the following prompt in the.pdf
forecastfashions
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
shaktisinhgandhinaga
 
662305 10
662305 10662305 10
Classes and object
Classes and objectClasses and object
Classes and object
Ankit Dubey
 
PROGRAM 2 – Fraction Class Problem For this programming as.pdf
PROGRAM 2 – Fraction Class Problem For this programming as.pdfPROGRAM 2 – Fraction Class Problem For this programming as.pdf
PROGRAM 2 – Fraction Class Problem For this programming as.pdf
ezonesolutions
 
Dotnet unit 4
Dotnet unit 4Dotnet unit 4
Dotnet unit 4
007laksh
 
Tank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engineTank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engine
Farzad Nozarian
 
Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019
UA Mobile
 
Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019
Eugene Kurko
 
Web2Day 2017 - Concilier DomainDriveDesign et API REST
Web2Day 2017 - Concilier DomainDriveDesign et API RESTWeb2Day 2017 - Concilier DomainDriveDesign et API REST
Web2Day 2017 - Concilier DomainDriveDesign et API REST
Nicolas Faugout
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
abhay singh
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
Keyur Vadodariya
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)
Domenic Denicola
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 preview
Paulo Morgado
 
2016 gunma.web games-and-asm.js
2016 gunma.web games-and-asm.js2016 gunma.web games-and-asm.js
2016 gunma.web games-and-asm.js
Noritada Shimizu
 
Intro to object oriented programming
Intro to object oriented programmingIntro to object oriented programming
Intro to object oriented programming
David Giard
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
Lorna Mitchell
 

Similar to Hi, Please find mu codeimport java.util.Random;public class Sup.pdf (20)

Android RenderScript
Android RenderScriptAndroid RenderScript
Android RenderScript
 
Kotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime PerformanceKotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime Performance
 
Please help me make a UML for Java! Look at the code below and make a.docx
Please help me make a UML for Java! Look at the code below and make a.docxPlease help me make a UML for Java! Look at the code below and make a.docx
Please help me make a UML for Java! Look at the code below and make a.docx
 
Using Java, please write the program for the following prompt in the.pdf
Using Java, please write the program for the following prompt in the.pdfUsing Java, please write the program for the following prompt in the.pdf
Using Java, please write the program for the following prompt in the.pdf
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
 
662305 10
662305 10662305 10
662305 10
 
Classes and object
Classes and objectClasses and object
Classes and object
 
PROGRAM 2 – Fraction Class Problem For this programming as.pdf
PROGRAM 2 – Fraction Class Problem For this programming as.pdfPROGRAM 2 – Fraction Class Problem For this programming as.pdf
PROGRAM 2 – Fraction Class Problem For this programming as.pdf
 
Dotnet unit 4
Dotnet unit 4Dotnet unit 4
Dotnet unit 4
 
Tank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engineTank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engine
 
Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019
 
Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019
 
Web2Day 2017 - Concilier DomainDriveDesign et API REST
Web2Day 2017 - Concilier DomainDriveDesign et API RESTWeb2Day 2017 - Concilier DomainDriveDesign et API REST
Web2Day 2017 - Concilier DomainDriveDesign et API REST
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 preview
 
2016 gunma.web games-and-asm.js
2016 gunma.web games-and-asm.js2016 gunma.web games-and-asm.js
2016 gunma.web games-and-asm.js
 
Intro to object oriented programming
Intro to object oriented programmingIntro to object oriented programming
Intro to object oriented programming
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 

More from karan8801

1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
karan8801
 
#include iostream #include cstddefusing namespace std;temp.pdf
#include iostream #include cstddefusing namespace std;temp.pdf#include iostream #include cstddefusing namespace std;temp.pdf
#include iostream #include cstddefusing namespace std;temp.pdf
karan8801
 
omparative historical research is a method of social science that e.pdf
 omparative historical research is a method of social science that e.pdf omparative historical research is a method of social science that e.pdf
omparative historical research is a method of social science that e.pdf
karan8801
 
1 .D 2.BSolution 1 .D 2.B.pdf
 1 .D 2.BSolution 1 .D 2.B.pdf 1 .D 2.BSolution 1 .D 2.B.pdf
1 .D 2.BSolution 1 .D 2.B.pdf
karan8801
 
where is it .pdf
                     where is it                                      .pdf                     where is it                                      .pdf
where is it .pdf
karan8801
 
The name of the reaction is aldol condesation (Cl.pdf
                     The name of the reaction is aldol condesation (Cl.pdf                     The name of the reaction is aldol condesation (Cl.pdf
The name of the reaction is aldol condesation (Cl.pdf
karan8801
 
Step1 3 moles of H2O react with Cr metal = 2moles.pdf
                     Step1 3 moles of H2O react with Cr metal = 2moles.pdf                     Step1 3 moles of H2O react with Cr metal = 2moles.pdf
Step1 3 moles of H2O react with Cr metal = 2moles.pdf
karan8801
 
sp2 - sp2 .pdf
                     sp2 - sp2                                       .pdf                     sp2 - sp2                                       .pdf
sp2 - sp2 .pdf
karan8801
 
Part A neutralizes acids - base Part B produces.pdf
                     Part A neutralizes acids - base Part B produces.pdf                     Part A neutralizes acids - base Part B produces.pdf
Part A neutralizes acids - base Part B produces.pdf
karan8801
 
Lewis Acid Base Reaction .pdf
                     Lewis Acid Base Reaction                         .pdf                     Lewis Acid Base Reaction                         .pdf
Lewis Acid Base Reaction .pdf
karan8801
 
KOH ==== K+ (aq) + OH-(aq) [OH-] =9.710^-5 [H.pdf
                     KOH ==== K+ (aq) + OH-(aq)  [OH-] =9.710^-5  [H.pdf                     KOH ==== K+ (aq) + OH-(aq)  [OH-] =9.710^-5  [H.pdf
KOH ==== K+ (aq) + OH-(aq) [OH-] =9.710^-5 [H.pdf
karan8801
 
It is a reaction for secondary amines .Option 2 i.pdf
                     It is a reaction for secondary amines .Option 2 i.pdf                     It is a reaction for secondary amines .Option 2 i.pdf
It is a reaction for secondary amines .Option 2 i.pdf
karan8801
 
fluorene is mobile phase and fluorenone is statio.pdf
                     fluorene is mobile phase and fluorenone is statio.pdf                     fluorene is mobile phase and fluorenone is statio.pdf
fluorene is mobile phase and fluorenone is statio.pdf
karan8801
 
equivalent mass is 27.9 . so Molecular massmole.pdf
                     equivalent mass is 27.9 .  so Molecular massmole.pdf                     equivalent mass is 27.9 .  so Molecular massmole.pdf
equivalent mass is 27.9 . so Molecular massmole.pdf
karan8801
 
There is no solutionSolutionThere is no solution.pdf
There is no solutionSolutionThere is no solution.pdfThere is no solutionSolutionThere is no solution.pdf
There is no solutionSolutionThere is no solution.pdf
karan8801
 
This is a case of allopatric speciation. In this case lice from gori.pdf
This is a case of allopatric speciation. In this case lice from gori.pdfThis is a case of allopatric speciation. In this case lice from gori.pdf
This is a case of allopatric speciation. In this case lice from gori.pdf
karan8801
 
d. 8 The bonding electrons are the electrons taki.pdf
                     d. 8 The bonding electrons are the electrons taki.pdf                     d. 8 The bonding electrons are the electrons taki.pdf
d. 8 The bonding electrons are the electrons taki.pdf
karan8801
 
The genetical changes of single locus are responsible for divergent .pdf
The genetical changes of single locus are responsible for divergent .pdfThe genetical changes of single locus are responsible for divergent .pdf
The genetical changes of single locus are responsible for divergent .pdf
karan8801
 
The corrects answers areThr and Asn are polar amino acids.Isole.pdf
The corrects answers areThr and Asn are polar amino acids.Isole.pdfThe corrects answers areThr and Asn are polar amino acids.Isole.pdf
The corrects answers areThr and Asn are polar amino acids.Isole.pdf
karan8801
 
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdfSince Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
karan8801
 

More from karan8801 (20)

1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
1. C.HIV is a virus it can be tansmitted through body fluids liks .pdf
 
#include iostream #include cstddefusing namespace std;temp.pdf
#include iostream #include cstddefusing namespace std;temp.pdf#include iostream #include cstddefusing namespace std;temp.pdf
#include iostream #include cstddefusing namespace std;temp.pdf
 
omparative historical research is a method of social science that e.pdf
 omparative historical research is a method of social science that e.pdf omparative historical research is a method of social science that e.pdf
omparative historical research is a method of social science that e.pdf
 
1 .D 2.BSolution 1 .D 2.B.pdf
 1 .D 2.BSolution 1 .D 2.B.pdf 1 .D 2.BSolution 1 .D 2.B.pdf
1 .D 2.BSolution 1 .D 2.B.pdf
 
where is it .pdf
                     where is it                                      .pdf                     where is it                                      .pdf
where is it .pdf
 
The name of the reaction is aldol condesation (Cl.pdf
                     The name of the reaction is aldol condesation (Cl.pdf                     The name of the reaction is aldol condesation (Cl.pdf
The name of the reaction is aldol condesation (Cl.pdf
 
Step1 3 moles of H2O react with Cr metal = 2moles.pdf
                     Step1 3 moles of H2O react with Cr metal = 2moles.pdf                     Step1 3 moles of H2O react with Cr metal = 2moles.pdf
Step1 3 moles of H2O react with Cr metal = 2moles.pdf
 
sp2 - sp2 .pdf
                     sp2 - sp2                                       .pdf                     sp2 - sp2                                       .pdf
sp2 - sp2 .pdf
 
Part A neutralizes acids - base Part B produces.pdf
                     Part A neutralizes acids - base Part B produces.pdf                     Part A neutralizes acids - base Part B produces.pdf
Part A neutralizes acids - base Part B produces.pdf
 
Lewis Acid Base Reaction .pdf
                     Lewis Acid Base Reaction                         .pdf                     Lewis Acid Base Reaction                         .pdf
Lewis Acid Base Reaction .pdf
 
KOH ==== K+ (aq) + OH-(aq) [OH-] =9.710^-5 [H.pdf
                     KOH ==== K+ (aq) + OH-(aq)  [OH-] =9.710^-5  [H.pdf                     KOH ==== K+ (aq) + OH-(aq)  [OH-] =9.710^-5  [H.pdf
KOH ==== K+ (aq) + OH-(aq) [OH-] =9.710^-5 [H.pdf
 
It is a reaction for secondary amines .Option 2 i.pdf
                     It is a reaction for secondary amines .Option 2 i.pdf                     It is a reaction for secondary amines .Option 2 i.pdf
It is a reaction for secondary amines .Option 2 i.pdf
 
fluorene is mobile phase and fluorenone is statio.pdf
                     fluorene is mobile phase and fluorenone is statio.pdf                     fluorene is mobile phase and fluorenone is statio.pdf
fluorene is mobile phase and fluorenone is statio.pdf
 
equivalent mass is 27.9 . so Molecular massmole.pdf
                     equivalent mass is 27.9 .  so Molecular massmole.pdf                     equivalent mass is 27.9 .  so Molecular massmole.pdf
equivalent mass is 27.9 . so Molecular massmole.pdf
 
There is no solutionSolutionThere is no solution.pdf
There is no solutionSolutionThere is no solution.pdfThere is no solutionSolutionThere is no solution.pdf
There is no solutionSolutionThere is no solution.pdf
 
This is a case of allopatric speciation. In this case lice from gori.pdf
This is a case of allopatric speciation. In this case lice from gori.pdfThis is a case of allopatric speciation. In this case lice from gori.pdf
This is a case of allopatric speciation. In this case lice from gori.pdf
 
d. 8 The bonding electrons are the electrons taki.pdf
                     d. 8 The bonding electrons are the electrons taki.pdf                     d. 8 The bonding electrons are the electrons taki.pdf
d. 8 The bonding electrons are the electrons taki.pdf
 
The genetical changes of single locus are responsible for divergent .pdf
The genetical changes of single locus are responsible for divergent .pdfThe genetical changes of single locus are responsible for divergent .pdf
The genetical changes of single locus are responsible for divergent .pdf
 
The corrects answers areThr and Asn are polar amino acids.Isole.pdf
The corrects answers areThr and Asn are polar amino acids.Isole.pdfThe corrects answers areThr and Asn are polar amino acids.Isole.pdf
The corrects answers areThr and Asn are polar amino acids.Isole.pdf
 
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdfSince Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
Since Z4 has an element of order 4,Z4, its a cyclic group of order 4.pdf
 

Recently uploaded

DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 

Recently uploaded (20)

DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 

Hi, Please find mu codeimport java.util.Random;public class Sup.pdf

  • 1. Hi, Please find mu code: import java.util.Random; public class SuperDie { private int sides; private Random rand; public SuperDie(){ // Default constructor sides = 6; rand = new Random(); } // Constructor that lets user define number of sides n. public SuperDie(int n){ sides = n; rand = new Random(); } // Constructor that lets user define number of sides n AND provide their own Random object. public SuperDie(int n, Random r){ sides = n; rand = r; } public int getNumSides(){ return sides; } public void setNumSides(int n){ sides = n; } public int roll(){ return rand.nextInt(sides)+1; }
  • 2. } import java.util.*; class MainDie { public static void main (String[] args) { int value, sides; Random rand = new Random(); SuperDie d1 = new SuperDie(); SuperDie d2 = new SuperDie(20); SuperDie d3 = new SuperDie(10,rand); value = d1.roll(); System.out.println ("die1 = " + value); value = d2.roll(); System.out.println ("die2 = " + value); value = d3.roll(); System.out.println ("die3 = " + value); d1.setNumSides(8); System.out.println ("die1 = " + d1.getNumSides()); } } /* Sample Output: die1 = 5 die2 = 5 die3 = 2 die1 = 8 */ Solution Hi, Please find mu code: import java.util.Random;
  • 3. public class SuperDie { private int sides; private Random rand; public SuperDie(){ // Default constructor sides = 6; rand = new Random(); } // Constructor that lets user define number of sides n. public SuperDie(int n){ sides = n; rand = new Random(); } // Constructor that lets user define number of sides n AND provide their own Random object. public SuperDie(int n, Random r){ sides = n; rand = r; } public int getNumSides(){ return sides; } public void setNumSides(int n){ sides = n; } public int roll(){ return rand.nextInt(sides)+1; } } import java.util.*; class MainDie {
  • 4. public static void main (String[] args) { int value, sides; Random rand = new Random(); SuperDie d1 = new SuperDie(); SuperDie d2 = new SuperDie(20); SuperDie d3 = new SuperDie(10,rand); value = d1.roll(); System.out.println ("die1 = " + value); value = d2.roll(); System.out.println ("die2 = " + value); value = d3.roll(); System.out.println ("die3 = " + value); d1.setNumSides(8); System.out.println ("die1 = " + d1.getNumSides()); } } /* Sample Output: die1 = 5 die2 = 5 die3 = 2 die1 = 8 */