Please Create New Java Ant Project Netbeans Called Final220 Followed First Name Example Pr Q43783687
Please create a new Java (ANT) Project in NetBeans, calledFinal220 followed by your first name.
For example, my project would be namedFinal220_Samuel.
In the same package as the generated Final220… class, pleasecreate a new Java class called PlayingDie.
Purpose:
Simulate a Playing Die with any number of sides
Constants/Fields:
As needed
Methods:
getNumberOfSides – returns how many sides are in thisPlayingDie object
getCurrentSideUp – returns the visible value of what sideis currently face-up (e.g. 1)
rollDie (declare this method to be final) – using a randomnumber, sets the current side up to a random number within therange of possible sides. For example, a two or three is fine for afour-sided PlayingDie but nine would not work.
Constructors:
1. No-Arg – Calls the one-arg constructor (using keyword this) toset the number of sides of the PlayingDie to a class default valueof 6.
2. One-Arg –
a) set number of sides of PlayingDie to value of argument (fromuser) If that value is valid, as follows:
If the value passed in to the constructor is an even number, thenset the number of sides of the PlayingDie object to that number.Otherwise, set the number of sides of the object to one more thanwhat the user specified. For example, if the user specifies 11sides, then set the number of sides in the PlayingDie to 12.
b) make sure the PlayingDie starts out on any valid randomside.
c) any other initialization tasks, as needed.
In your main method:
1. Please create one instance (object) of thisPlayingDie class using the one-arg constructorwith however number of sides you wish to specify. Please alsocreate a second PlayingDie with the default numberof sides using the no-arg constructor. You can create these ineither order (one-arg then no-arg or no-arg then one-arg).
2. Please output the current (i.e. starting) value of bothdice’s number of sides and their side up.
3. Please use a loop to roll both dice four times and to outputeach PlayingDie’s side up at each iteration.
Sample output:
d1 Number of sides: 6
d2 Number of sides: 12
d1 Initial side up: 6
d2 Initial side up: 11
d1 side up: 5
d2 side up: 1
d1 side up: 4
d2 side up: 11
….
Expert Answer
Answer to Please create a new Java (ANT) Project in NetBeans, called Final220 followed by your first name. For example, my project…
OR