Question Solved1 Answer java Problem Description: Design a class named MyInteger. The class contains: An int data field named value that stores the int value represented by this object. • A constructor that creates a MyInteger object for the specified int value. . A get method that returns the int value. • Methods isEven (), isOdd (), and isPrime() that return true if the value is even, odd, or prime, respectively. Static methods isEven (int), isOdd (int), and is Prime (int) that return true if the specified value is even, odd, or prime, respectively. • Static methods isEven (MyInteger), isOdd (MyInteger), and isPrime (MyInteger) that return true if the specified value is even, odd, or prime, respectively. • Methods eguals (int) and equals (MyInteger) that return true if the value in the object is equal to the specified value. • A static method parseInt(char(that converts an array of numeric characters to an int value. • A static method parseInt(String) that converts a string into an int value. Draw the UML diagram for the class. Implement the class. Write a client program that tests all methods in the class. Design: Draw the UML class diagram here MyInteger

EBURPZ The Asker · Computer Science

java

Transcribed Image Text: Problem Description: Design a class named MyInteger. The class contains: An int data field named value that stores the int value represented by this object. • A constructor that creates a MyInteger object for the specified int value. . A get method that returns the int value. • Methods isEven (), isOdd (), and isPrime() that return true if the value is even, odd, or prime, respectively. Static methods isEven (int), isOdd (int), and is Prime (int) that return true if the specified value is even, odd, or prime, respectively. • Static methods isEven (MyInteger), isOdd (MyInteger), and isPrime (MyInteger) that return true if the specified value is even, odd, or prime, respectively. • Methods eguals (int) and equals (MyInteger) that return true if the value in the object is equal to the specified value. • A static method parseInt(char(that converts an array of numeric characters to an int value. • A static method parseInt(String) that converts a string into an int value. Draw the UML diagram for the class. Implement the class. Write a client program that tests all methods in the class. Design: Draw the UML class diagram here MyInteger
More
Transcribed Image Text: Problem Description: Design a class named MyInteger. The class contains: An int data field named value that stores the int value represented by this object. • A constructor that creates a MyInteger object for the specified int value. . A get method that returns the int value. • Methods isEven (), isOdd (), and isPrime() that return true if the value is even, odd, or prime, respectively. Static methods isEven (int), isOdd (int), and is Prime (int) that return true if the specified value is even, odd, or prime, respectively. • Static methods isEven (MyInteger), isOdd (MyInteger), and isPrime (MyInteger) that return true if the specified value is even, odd, or prime, respectively. • Methods eguals (int) and equals (MyInteger) that return true if the value in the object is equal to the specified value. • A static method parseInt(char(that converts an array of numeric characters to an int value. • A static method parseInt(String) that converts a string into an int value. Draw the UML diagram for the class. Implement the class. Write a client program that tests all methods in the class. Design: Draw the UML class diagram here MyInteger
See Answer
Add Answer +20 Points
Community Answer
C3XPKP The First Answerer
See all the answers with 1 Unlock
Get 4 Free Unlocks by registration

General GuidanceThe answer provided below has been developed in a clear step by step manner.Step: 1.lcWjel{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;font-size:0.75rem;box-sizing:border-box;}/*!sc*/ data-styled.g366[id="sc-mwpquf-0"]{content:"lcWjel,"}/*!sc*/ .loOCZZ{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;}/*!sc*/ .loOCZZ .align-left{text-align:left;}/*!sc*/ .loOCZZ .align-center{text-align:center;}/*!sc*/ .loOCZZ .align-right{text-align:right;}/*!sc*/ data-styled.g367[id="sc-mwpquf-1"]{content:"loOCZZ,"}/*!sc*/ .cpESDm .DraftEditor-editorContainer,.cpESDm .DraftEditor-root,.cpESDm .public-DraftEditor-content{height:inherit;text-align:initial;}/*!sc*/ .cpESDm .public-DraftEditor-content[contenteditable='true']{-webkit-user-modify:read-write-plaintext-only;}/*!sc*/ .cpESDm .DraftEditor-root{position:relative;}/*!sc*/ .cpESDm .DraftEditor-editorContainer{background-color:rgba(255,255,255,0);border-left:0.1px solid transparent;position:relative;z-index:1;}/*!sc*/ .cpESDm .public-DraftEditor-block{position:relative;}/*!sc*/ .cpESDm .DraftEditor-alignLeft .public-DraftStyleDefault-block{text-align:left;}/*!sc*/ .cpESDm .DraftEditor-alignLeft .public-DraftEditorPlaceholder-root{left:0;text-align:left;}/*!sc*/ .cpESDm .DraftEditor-alignCenter .public-DraftStyleDefault-block{text-align:center;}/*!sc*/ .cpESDm .DraftEditor-alignCenter .public-DraftEditorPlaceholder-root{margin:0 auto;text-align:center;width:100%;}/*!sc*/ .cpESDm .DraftEditor-alignRight .public-DraftStyleDefault-block{text-align:right;}/*!sc*/ .cpESDm .DraftEditor-alignRight .public-DraftEditorPlaceholder-root{right:0;text-align:right;}/*!sc*/ .cpESDm .public-DraftEditorPlaceholder-root{color:#9197a3;position:absolute;width:100%;z-index:1;}/*!sc*/ .cpESDm .public-DraftEditorPlaceholder-hasFocus{color:#bdc1c9;}/*!sc*/ .cpESDm .DraftEditorPlaceholder-hidden{display:none;}/*!sc*/ .cpESDm .public-DraftStyleDefault-block{position:relative;white-space:pre-wrap;}/*!sc*/ .cpESDm .public-DraftStyleDefault-ltr{direction:ltr;text-align:left;}/*!sc*/ .cpESDm .public-DraftStyleDefault-rtl{direction:rtl;text-align:right;}/*!sc*/ .cpESDm .public-DraftStyleDefault-listLTR{direction:ltr;}/*!sc*/ .cpESDm .public-DraftStyleDefault-listRTL{direction:rtl;}/*!sc*/ .cpESDm .public-DraftStyleDefault-ol,.cpESDm .public-DraftStyleDefault-ul{margin:16px 0;padding:0;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-listLTR{margin-left:1.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-listRTL{margin-right:1.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-listLTR{margin-left:3em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-listRTL{margin-right:3em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-listLTR{margin-left:4.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-listRTL{margin-right:4.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-listLTR{margin-left:6em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-listRTL{margin-right:6em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-listLTR{margin-left:7.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-listRTL{margin-right:7.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-unorderedListItem{list-style-type:square;position:relative;}/*!sc*/ .cpESDm .public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth0{list-style-type:disc;}/*!sc*/ .cpESDm .public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth1{list-style-type:circle;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem{list-style-type:none;position:relative;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-listLTR:before{left:-36px;position:absolute;text-align:right;width:30px;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-listRTL:before{position:absolute;right:-36px;text-align:left;width:30px;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem:before{content:counter(ol0) '. ';counter-increment:ol0;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth1:before{content:counter(ol1,lower-alpha) '. ';counter-increment:ol1;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth2:before{content:counter(ol2,lower-roman) '. ';counter-increment:ol2;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth3:before{content:counter(ol3) '. ';counter-increment:ol3;}/*!sc*/ .cpESDm .public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth4:before{content:counter(ol4,lower-alpha) '. ';counter-increment:ol4;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-reset{counter-reset:ol0;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-reset{counter-reset:ol1;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-reset{counter-reset:ol2;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-reset{counter-reset:ol3;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-reset{counter-reset:ol4;}/*!sc*/ .cpESDm .public-DraftStyleDefault-ltr{text-align:inherit;}/*!sc*/ .cpESDm .public-DraftStyleDefault-rtl{text-align:inherit;}/*!sc*/ data-styled.g370[id="sc-mwpquf-4"]{content:"cpESDm,"}/*!sc*/ .jHZMpP{white-space:pre-wrap;}/*!sc*/ data-styled.g384[id="sc-1hpkftd-0"]{content:"jHZMpP,"}/*!sc*/ .lfgtFE{text-align:start;}/*!sc*/ data-styled.g386[id="sc-1hpkftd-2"]{content:"lfgtFE,"}/*!sc*/ .jhimFq{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;box-sizing:border-box;border:2px solid transparent;}/*!sc*/ .jhimFq h2{font-size:16px;}/*!sc*/ .jhimFq h3{font-size:14px;}/*!sc*/ data-styled.g412[id="sc-mo29cs-0"]{content:"jhimFq,"}/*!sc*/ .hvnimP{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;font-size:0.75rem;box-sizing:border-box;}/*!sc*/ data-styled.g561[id="sc-2n8uaj-0"]{content:"hvnimP,"}/*!sc*/ .hKYAjt{position:relative;}/*!sc*/ data-styled.g562[id="sc-2n8uaj-1"]{content:"hKYAjt,"}/*!sc*/ .iwfmHn::before{position:absolute;content:attr(data-line);color:rgba(60,60,60,0.5);top:0;bottom:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:flex-end;-webkit-box-align:flex-end;-ms-flex-align:flex-end;align-items:flex-end;}/*!sc*/ data-styled.g563[id="sc-2n8uaj-2"]{content:"iwfmHn,"}/*!sc*/ .jGJnqk{margin-left:2em;}/*!sc*/ data-styled.g564[id="sc-2n8uaj-3"]{content:"jGJnqk,"}/*!sc*/ .jYKUgh{background-color:#f7f7f7;}/*!sc*/ .jYKUgh code[class*='language-'],.jYKUgh pre[class*='language-']{color:black;background:none;text-shadow:0 1px white;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none;}/*!sc*/ .jYKUgh pre[class*='language-']::-moz-selection,.jYKUgh pre[class*='language-']::-moz-selection,.jYKUgh code[class*='language-']::-moz-selection,.jYKUgh code[class*='language-']::-moz-selection{text-shadow:none;background:#b3d4fc;}/*!sc*/ .jYKUgh pre[class*='language-']::selection,.jYKUgh pre[class*='language-']::selection,.jYKUgh code[class*='language-']::selection,.jYKUgh code[class*='language-']::selection{text-shadow:none;background:#b3d4fc;}/*!sc*/ @media print{.jYKUgh code[class*='language-'],.jYKUgh pre[class*='language-']{text-shadow:none;}}/*!sc*/ .jYKUgh pre[class*='language-']{padding:1em;margin:0.5em 0;overflow:auto;}/*!sc*/ .jYKUgh:not(pre) > code[class*='language-'],.jYKUgh pre[class*='language-']{background:#f5f2f0;}/*!sc*/ .jYKUgh:not(pre) > code[class*='language-']{padding:0.1em;border-radius:0.3em;white-space:normal;}/*!sc*/ .jYKUgh div,.jYKUgh span,.jYKUgh .token{font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;}/*!sc*/ .jYKUgh .token.comment,.jYKUgh .token.prolog,.jYKUgh .token.doctype,.jYKUgh .token.cdata{color:slategray;}/*!sc*/ .jYKUgh .token.punctuation{color:#999;}/*!sc*/ .jYKUgh .token.namespace{opacity:0.7;}/*!sc*/ .jYKUgh .token.property,.jYKUgh .token.tag,.jYKUgh .token.boolean,.jYKUgh .token.number,.jYKUgh .token.constant,.jYKUgh .token.symbol,.jYKUgh .token.deleted{color:#905;}/*!sc*/ .jYKUgh .token.selector,.jYKUgh .token.attr-name,.jYKUgh .token.string,.jYKUgh .token.char,.jYKUgh .token.builtin,.jYKUgh .token.inserted{color:#690;}/*!sc*/ .jYKUgh .token.operator,.jYKUgh .token.entity,.jYKUgh .token.url,.jYKUgh .language-css .token.string,.jYKUgh .style .token.string{color:#9a6e3a;}/*!sc*/ .jYKUgh .token.atrule,.jYKUgh .token.attr-value,.jYKUgh .token.keyword{color:#07a;}/*!sc*/ .jYKUgh .token.function,.jYKUgh .token.class-name{color:#dd4a68;}/*!sc*/ .jYKUgh .token.regex,.jYKUgh .token.important,.jYKUgh .token.variable{color:#e90;}/*!sc*/ .jYKUgh .token.important,.jYKUgh .token.bold{font-weight:bold;}/*!sc*/ .jYKUgh .token.italic{font-style:italic;}/*!sc*/ .jYKUgh .token.entity{cursor:help;}/*!sc*/ data-styled.g565[id="sc-2n8uaj-4"]{content:"jYKUgh,"}/*!sc*/ .iQAUeM{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:16px;}/*!sc*/ data-styled.g638[id="sc-z3f5s1-0"]{content:"iQAUeM,"}/*!sc*/ .gOmRZU{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;font-size:0.75rem;width:100%;text-align:center;}/*!sc*/ data-styled.g640[id="sc-1uwiggj-0"]{content:"gOmRZU,"}/*!sc*/ .cjeDVH{max-width:70%;}/*!sc*/ data-styled.g641[id="sc-1uwiggj-1"]{content:"cjeDVH,"}/*!sc*/ .bVFlsN{margin:0;}/*!sc*/ data-styled.g643[id="sc-1swtczx-0"]{content:"bVFlsN,"}/*!sc*/ .gpAhdE{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;line-height:normal;}/*!sc*/ data-styled.g658[id="sc-1sugbjn-0"]{content:"gpAhdE,"}/*!sc*/ Explanation : isEven() - number%2 ==0 means evenisOdd() => number%2==1 means odd prime() => number is divisible by 1 and itselfExample .int n=0; for(int i=1;i<=value;i++){ if(value%i==0) n++; } if(n==2) return true; return false;Explanation:Please refer to solution in this step.Step: 2.lcWjel{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;font-size:0.75rem;box-sizing:border-box;}/*!sc*/ data-styled.g366[id="sc-mwpquf-0"]{content:"lcWjel,"}/*!sc*/ .loOCZZ{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;}/*!sc*/ .loOCZZ .align-left{text-align:left;}/*!sc*/ .loOCZZ .align-center{text-align:center;}/*!sc*/ .loOCZZ .align-right{text-align:right;}/*!sc*/ data-styled.g367[id="sc-mwpquf-1"]{content:"loOCZZ,"}/*!sc*/ .cpESDm .DraftEditor-editorContainer,.cpESDm .DraftEditor-root,.cpESDm .public-DraftEditor-content{height:inherit;text-align:initial;}/*!sc*/ .cpESDm .public-DraftEditor-content[contenteditable='true']{-webkit-user-modify:read-write-plaintext-only;}/*!sc*/ .cpESDm .DraftEditor-root{position:relative;}/*!sc*/ .cpESDm .DraftEditor-editorContainer{background-color:rgba(255,255,255,0);border-left:0.1px solid transparent;position:relative;z-index:1;}/*!sc*/ .cpESDm .public-DraftEditor-block{position:relative;}/*!sc*/ .cpESDm .DraftEditor-alignLeft .public-DraftStyle ... See the full answer