Given three int variables that have been declared and given values, areaCode, exchange, and lastFour, write a String expression whose value is the String equivalent of each these variables joined by a single hyphen (-) So if areaCode, exchange, and lastFour, had the values 800, 555, and 1212, the expression ‘s value would be “800-555-1212”. Alternatively, if areaCode, exchange, and lastFour, had the values 212, 867 and 5309 the expression ‘s value would be “212-867-5309”.
LANGUAGE: JAVA
CHALLENGE:
Given three int variables that have been declared and given values, areaCode, exchange, and lastFour, write a String expression whose value is the String equivalent of each these variables joined by a single hyphen (-) So if areaCode, exchange, and lastFour, had the values 800, 555, and 1212, the expression ‘s value would be “800-555-1212”. Alternatively, if areaCode, exchange, and lastFour, had the values 212, 867 and 5309 the expression ‘s value would be “212-867-5309”.
SOLUTION:
areaCode + "-" + exchange + "-" + lastFour