Answer to Question #278691 in Java | JSP | JSF for hab1bti

Question #278691

Create



a



constructor



for



Die( singular dice as in one)



that



takes



one



argument,



an



int



representing



the



number



of



sides.



If the number is less than 2, store 6 as the number of sides in the class field.



Other-



wise, store the number given.



1
Expert's answer
2021-12-13T00:02:52-0500


package die;


public class Die {
 private int sides;
   Die(int n){
       if(n<2){
           sides = 6;
       }
       else{
           sides = n;
       }
   }
    public static void main(String[] args) {
       
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS