What is the output of this program? public class Calculate { public int doMath(int x, int...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
What is the output of this program? public class Calculate { public int doMath(int x, int y) { return (x-y); } } public class CalculateApp { public static void main() { int x =5; int y = 20; Calculate cal= new Calculate(): x= cal.doMath(y.x); System.out.print("x=" +x+", y="+y); y = cal.doMath(x.x): System.out.print("x=" +x+", y=" + y): } } Ox=15, y=20 x=15, y=0 Ox-15, y=20 x=0,y= 15 x-15, y=20 x=15, y=20 Ox=0, y=15x=15, y= 20 What is the output of this program? public class Calculate { public int doMath(int x, int y) { return (x-y); } } public class CalculateApp { public static void main() { int x =5; int y = 20; Calculate cal= new Calculate(): x= cal.doMath(y.x); System.out.print("x=" +x+", y="+y); y = cal.doMath(x.x): System.out.print("x=" +x+", y=" + y): } } Ox=15, y=20 x=15, y=0 Ox-15, y=20 x=0,y= 15 x-15, y=20 x=15, y=20 Ox=0, y=15x=15, y= 20
Expert Answer:
Answer rating: 100% (QA)
Lets break down the code and analyze the output step by step 1 We have two classes Calculate and Cal... View the full answer
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date:
Students also viewed these programming questions
-
Timberly Construction makes a lump-sum purchase of several assets on January 1 at a total cash price of $810,000. The estimated market values of the purchased assets are building, $477,750; land,...
-
What is the output of this code? Explain how did you made the file and provide a pic of the out put. import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class...
-
What is global investment outlook for US Large Cap Market, the mutual fund Akre Focus Instl-AKRIX?
-
Write a paper on Health-Care Fraud
-
Find the first and second derivatives of the following function and use them to sketch a graph. f(x) = 1/x2 for 0 < x 2.
-
To minimize the potential for gastrointestinal disease outbreaks, all passenger cruise ships arriving at U.S. ports are subject to unannounced sanitation inspections. Ships are rated on a 100-point...
-
What are the classes of transcription errors?
-
In 2011, Borland Semiconductors entered into the transactions described below. In 2008, Borland had issued 170 million shares of its $1 par common stock at $34 per share. Required: Assuming that...
-
In each of the following, tell which computation should be done last. 1.5(16-8)-18 II. 54/(10-5+8) III. (14-5)+(4.8) IV. 720/360+8 Which computation should be done last in 5(16-8) - 18? OA. Subtract...
-
You are given the following information about the mid-size truck market in the USA, specifically the fictitious Mullins Trucking Corporation, Inc. in Rochester, NY. The graph you are about to...
-
The accompanying data file shows the salary (in $) and work experience (in years) of 100 employees in a marketing firm. Click here for the Excel Data File a. Construct the five-number summary for...
-
Consider an order allocation problem under multiple sourcing, where it is required to buy 2000 units of a certain product from three different suppliers. The fixed setup cost (independent of the...
-
England Productions performs London shows. The average show sells 1,100 tickets at \($55\) per ticket. There are 110 shows a year. The average show has a cast of 65, each earning an average of...
-
Trevor Co.'s sales rose 10 percent over prior year sales of \(\$ 300,000\); however net income increased by 6 percent over the prior year's net income. If Trevor's prior year return on sales ratio...
-
The file named Companydata.xlsx contains information about the 2,000 largest companies in the world. Determine how many of the companies are banks and how many are US banks.
-
Consider an economy that is populated by a bank, consumers whose population is normalized to be 1, and a regulator. Each consumer is born in \(t=0\) with 1 unit of endowment, and they can invest in...
-
The standard utility formula has the form U = E(r) + 0.5A*s2 (where s2 is the portfolio return variance). Here A represents__ investor's return requirement investor's aversion to risk certainty equ...
-
A firm offers two products for sale. The marginal cost of one product is new zero once the first unit has been produced. The marginal cost of the other product rises as output rises. What would be...
-
For the next several questions, consider a file called readme.txt that has the following contents: What would be the output from the following code when it is run on the readme.txt file? 6.7 This...
-
How many nodes at most would be examined in a call to contains on a perfect binary search tree of height N?
-
Suppose you have a list of strings declared as follows. Write code to use stream operations to print all of the four-letter words in the list. List list = Arrays.asList("four", "score", ..., "ago");
-
Materials support cost for the Industrial Equipment Manufacturing Company depends on the weight of material (plate steel, castings, etc.) moved. For the current budget period and based on scheduled...
-
Parks Canada prepared the following budget for one of its national parks for 2006: The fees were based on an average of 50,000 vehicle-admission days (vehicles multiplied by number of days in park)...
-
The L. Ming Company has had great difficulty controlling costs in Singapore during the past three years. Last month a standard cost and flexible-budget system was installed. Results for a department...
Study smarter with the SolutionInn App