The following program contains 7 mistakes! What are they? What output is produced for each of the
Question:
The following program contains 7 mistakes! What are they?
What output is produced for each of the following calls?
a. IfElseMystery1(3, 20);
b. IfElseMystery1(4, 5);
c. IfElseMystery1(5, 5);
d. IfElseMystery1(6, 10);
Transcribed Image Text:
1 1 public class Oops4 { 2. public static void main (String[] args) { 3. int a = 7, b = 42; %3D 4 minimum (a, b); if {smaller = a} { System.out.println ("a is the smallest!"); 8 10 public static void minimum (int a, int b) { 11 if (a < b) { 12 int smaller = a; 13 } else (a => b) { 14 int smaller = b; 15 16 return int smaller; 17 18
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 50% (10 reviews)
Mistakes in Oops4 program 1 line 5 if statement should use parentheses not ...View the full answer
Answered By
AJIN KURIAKOSE
I HAVE ELECTRONICS ENGINEERING DEGREE..AND MY AREA OF INTEREST IS MATHEMATICS,CONTROL SYSTEM,NETWORK,DIGITAL
4.70+
21+ Reviews
32+ Question Solved
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted:
Students also viewed these Computer science questions
-
The following program contains 6 mistakes! What are they? public class Oops6 { public static void main (String [] args) { 3 Scanner in = new Scanner ("example.txt"); 4 countWords (in); 7 // Counts...
-
The following program contains at least 10 syntax errors. What are they?
-
The following program contains 9 mistakes! What are they? public class Oops2 { 2. public static void main (String [] args) { 3 int x; 4 System.out.println ("x is" x); int x = 15.2; // set x to 15.2...
-
The September 30, 2018, adjusted trial balance of Buzzy?s, Inc., is shown next. Requirements 1. Prepare the September closing entries for Buzzy?s, Inc. 2. Calculate the ending balance in Retained...
-
Replacing incandescent lights with energy-efficient fluorescent lights can reduce the lighting energy consumption to one-fourth of what it was before. The energy consumed by the lamps is eventually...
-
Question 3 (2 points) Consider a 25-year bond with 11 percent annual coupon payments. The market rate (YTM) is 7.5 percent for this bond. The current yield of the bond is percent. Answer it in...
-
How does bagging contribute to a reduction in the prediction error?
-
Tamra Corp. makes one product line. In February 2010, Tamra paid $530,000 in factory overhead costs. Of that amount, $124,000 was for Januarys factory utilities and $48,000 was for property taxes on...
-
A bond with an annual coupon rate of 4.0% sells for $955. What is the bonds current yield? (Round your answer to 2 decimal places.)
-
To measure the capacitance of a conductor, it is first charged to a potential Vo = 1350V. It is then connected by a conducting wire to a distant metal sphere of radius r = 3cm. As a result the...
-
Write a program that prompts for two peoples birthdays (month and day), along with todays month and day. The program should figure out how many days remain until each users birthday and which...
-
Write a method called daysInMonth that takes a month (an integer between 1 and 12) as a parameter and returns the number of days in that month in this year. For example, the call daysInMonth(9) would...
-
What are the potential drawbacks of franchising for both parties?
-
Evaluation a. Evaluate the effectiveness of social media marketing campaign for instagram, facebook and pintrest ?based on your KPIs for example account reached, content reached, likes, shares,...
-
A study was performed at a university to analyze whether the preference for hamburgers or fried chicken is related to the gender of the student. This table lists the results of the study. At a =...
-
A 20-lb homogeneous box has tipped and is resting against a 40-lb homogeneous box as shown in figure attached. The coefficient of friction between box A and the floor is 0.7, and between box B and...
-
The Taylor series for natural logarithm (with base e) In(1+r) is In(1+2) -(-1)+1 for <1. (a) Write a user-defined function using loop that determines In(1+x) using the above Taylor series. Your...
-
Question 1: [up to 4 pts] Suppose that a = 1, a2 = 2, a3 = = 3, and an = an-3 for all n 4. If an integral with respect to y is used to find the area of R, what should the upper limit of integration...
-
In Problems, evaluate each expression. 4 + 2 2 /2
-
After looking at the resources, explain what a spirit image is. Why might looking at a god and/or a human in terms of their spirit be helpful if you want to eliminate some of the divisions between...
-
Compare the telephone network and the Internet. What are the similarities? What are the differences?
-
We need to have a space-division switch with 1000 inputs and outputs. What is the total number of crosspoints in each of the following cases? a. Using a single crossbar. b. Using a multi-stage switch...
-
It is obvious that a router or a switch needs to search to find information in the corresponding table. The searching in a routing table for a datagram network is based on the destination address;...
-
thumbs up if correct A stock paying no dividends is priced at $154. Over the next 3-months you expect the stock torpeither be up 10% or down 10%. The risk-free rate is 1% per annum compounded...
-
Question 17 2 pts Activities between affiliated entities, such as a company and its management, must be disclosed in the financial statements of a corporation as O significant relationships O segment...
-
Marchetti Company, a U.S.-based importer of wines and spirits, placed an order with a French supplier for 1,000 cases of wine at a price of 200 euros per case. The total purchase price is 200,000...
Study smarter with the SolutionInn App