Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class Outputdetermination { 2 public static void main ( String [ ] args ) { 3 int result = 0 ; 4 int [

public class Outputdetermination {
2 public static void main (String[] args){
3 int result =0;
4 int[] values ={4,11,17,43,91,0,54};
5
6 for(int i =0; i <4; i++){
7 if(i %2==0){
8 result += doSomething(values[i], values[i*2]);
9} else {
10 result += doSomething(Integer.toString(values[i]),"1"+ Integer.toString(values[5]));
11}
12}
13
14 System.out.println(result);
15}
16
17 public static int doSomething (int value1, int value2){
18 return value1+ value2;
19}
20
21 public static int doSomething (String value1, String value2){
22 return Integer.valueOf(value1)- Integer.valueOf(value2);
23}
24}
Enter the output of the main function (line 14):

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions

Question

Describe the nature of negative messages.

Answered: 1 week ago