?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Difficult

Arithmetic Using Methods from Different Classes

APCSA-KVWWTF

Consider the following two classes.

    public class Arithmetic1 
    {
        public int performMath(int num)
        {
            return num + multiplyNums(num);
        }

        public int multiplyNums(int num)
        {
            return num*2;
        }

        public int divideNums(int num1, int num2)
        {
            return num1 / num2;
        }
    }
    public class Arithmetic2 extends Arithmetic1
    {
        public int performMath(int num)
        {
            return super.performMath(num);
        }

        public int multiplyNums(int num)
        {
            return num*10;
        }
    }

What would the following code segment from a client class print to the console?

Arithmetic1 math1 = new Arithmetic1();
Arithmetic2 math2 = new Arithmetic2();
System.out.println(math1.performMath(20) + math2.performMath(10));
A

90

B

170

C

330

D

140

E

60