Question

In: Computer Science

Hi Can someone explain how the the output was achieved in details for this java question?...

Hi Can someone explain how the the output was achieved in details for this java question?

public class Example
  
{
public static void main(String [] args)
{
int a = 6, b = 5, i , num1, num2;
for (i = 1; i <= 3; ++i)
{
num1 = method1(a, b);
num2 = method2 (a, b);
System.out.println (num1 + " " + num2);
a = a + 2;
b = b - 1;
}
}
public static int method1 (int c, int d)
{
c = c + d;
return c;
}
public static int method2 (int e, int f)
{
f = f + e * 2 ;
return f ;
}
}

output

run:
11 17
12 20
13 23

Solutions

Expert Solution


Related Solutions

Hi can someone fully explain how the output was reached? thanks public class Example { public...
Hi can someone fully explain how the output was reached? thanks public class Example { public static void main(String [] args) { int a = 0, b = 4, i, j;    for (i = 1; i<=3; i++) { for(j = 1; j < 3; ++j) { a = a + j; b = b + a; System.out.println (a + " " + b); } } System.out.println ("ALL DONE"); } }    output 1 5 3 8 4 12 6...
Hi I am quite confused with how to use scanner for my java project? Can someone...
Hi I am quite confused with how to use scanner for my java project? Can someone help me with this? Thanks
java program: Input and output the following details. Your program can only receive the correct input....
java program: Input and output the following details. Your program can only receive the correct input. (For example: a notification will be given if you not enter Char data type for Name) Name: Ali bin Ahmad Occupation: Technician Age: 30 Hometown: Negeri Sembilan Years of Service: 12 Gender: Male
Hi all, Can someone please answer this question with all steps! Thank you! As a result...
Hi all, Can someone please answer this question with all steps! Thank you! As a result of improvements in product engineering, United Automation is able to sell one of its two milling machines. Both machines perform the same function but differ in age. The newer machine could be sold today for $69,500. Its operating costs are $22,600 a year, but in five years the machine will require a $18,700 overhaul. Thereafter operating costs will be $31,300 until the machine is...
Can someone please explain how can someone find how to find the adiabatic flame temperature in...
Can someone please explain how can someone find how to find the adiabatic flame temperature in Kelvin when liquid methane reacts with liquid oxygen? Please show the calculations.
Strategic Alliances can create value for firms. Explain how this can be achieved and use an...
Strategic Alliances can create value for firms. Explain how this can be achieved and use an example to support your answer. 400 words
Hi I'm having a hard time understand this can someone please explain it to me? Thank...
Hi I'm having a hard time understand this can someone please explain it to me? Thank you. Cholesterol is a type of fat found in the blood. It is measured as a concentration: the number of milligrams of cholesterol found per deciliter of blood (mg/dL). A high level of total cholesterol in the bloodstream increases risk for heart disease. For this problem, assume cholesterol in men and women follows a normal distribution, and that “adult man” and “adult woman” refers...
Hi, I can't figure out this question in excel, can someone please show me the excel...
Hi, I can't figure out this question in excel, can someone please show me the excel formulas to input in order to solve for part A and B please!!!! The following table contains closing monthly stock prices for Oracle Corporation (ORCL), Microsoft Corporation (MSFT), and NVidia (NVDA) for the first half of 2017. Ticker 6/30/2017 5/31/2017 4/30/2017 3/31/2017 2/28/2017 1/31/2017 ORCL 50.14 45.39 44.96 44.61 42.59 40.11 MSFT 68.93 69.84 68.46 65.86 63.98 64.65 NVDA 144.56 144.35 104.3 108.93 101.48...
Hi all, Can someone please answer this question. Please, list all steps! thanks! Machines A and...
Hi all, Can someone please answer this question. Please, list all steps! thanks! Machines A and B are mutually exclusive and are expected to produce the following real cash flows:       Cash Flows ($ thousands) Machine C0 C1 C2 C3 A –102 +112 +123 B –122 +112 +123 +135       The real opportunity cost of capital is 12%.    a. Calculate the NPV of each machine. (Do not round intermediate calculations. Enter your answers in dollars not in thousands, e.g....
Can someone explain how to find the P Value in Question 10, Chapter 9.1 of Applied...
Can someone explain how to find the P Value in Question 10, Chapter 9.1 of Applied Statistics and Probability for Engineers? Or just the general steps and cases for finding the P Value.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT