Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

nataevx) () sakieu x saaou x la saa@u x)Ousst2-ce. ×) eSearchleki Gi tHub. Inc.

ID: 3732172 • Letter: N

Question

nataevx) () sakieu x saaou x la saa@u x)Ousst2-ce. ×) eSearchleki Gi tHub. Inc. (USI https//github.com/csc211/s4 on1 Thingw QVuloris AugmentedThe Complete Web DWSchools Online Da R , sent we Milestone 2 - Due Thursday, March 22nd by 2PM (before class) Methods add( bigint &that;) Returns a new Bigtnt which is the sum of "this and thatthis and that are not modified by this operation bigint x-10; bigint y 15 bigint z -x.add()1 is 25, moreover x Is sti11 1e, y is still 15. subtract( bigint &that;) Returns a new Bigint which is the difference of this and that. "this must be larger than that for this operation to succeed (negative values are not allowed). bigint x 580; bigint y 800 bigint z-x.subtract(y): NOT ALLOWED Throws error bigint z-y subtract(x): I7 valid, z 3ee; y- 8:x-se multiplyt bigint &that; ) @ : here to search 0

Explanation / Answer

below is the solution:

package chegg;

import java.math.BigInteger;

public class BigIntCalculate {
   public static void main(String[] args)throws Exception {
       BigInteger x,y,z;//declare a bigInteger variable
       x = new BigInteger("10"); //assign the x value
       y = new BigInteger("15"); //assign the y value
       z=x.add(y); //add
       System.out.println("Addition of "+x+" + "+y+": "+z); //prints the z value
      
       x = new BigInteger("500");//assign the x value
       y = new BigInteger("800");//assign the y value
      
       /*z=x.subtract(y);
       System.out.println("Subtraction of "+x+" - "+y+": "+z);*/
      
       z=y.subtract(x); //subtract
       System.out.println("Subtraction of "+y+" - "+x+": "+z);//prints the z value
      
       x = new BigInteger("5");//assign the x value
       y = new BigInteger("2");//assign the y value
       z=x.multiply(y); //multiply
       System.out.println("Multiplication of "+x+" * "+y+": "+z);//prints the z value
      
       x = new BigInteger("6");//assign the x value
       y = new BigInteger("2");//assign the y value
       z=x.multiply(y); //divide
       System.out.println("Division of "+x+" / "+y+": "+z);//prints the z value
      
       x = new BigInteger("11");//assign the x value
       y = new BigInteger("10");//assign the y value
       z=x.mod(y); //mod
       System.out.println("Mod of "+x+" % "+y+": "+z);//prints the z value
      
       x = new BigInteger("2");//assign the x value
       System.out.println("Power of "+x+": "+x.pow(2));//prints the x value
   }

}

sample output:

Addition of 10 + 15: 25
Subtraction of 800 - 500: 300
Multiplication of 5 * 2: 10
Division of 6 / 2: 12
Mod of 11 % 10: 1
Power of 2: 4