Write an application that inputs three integers from the user and displays the sum, average, product, smallest
Question:
Write an application that inputs three integers from the user and displays the sum, average, product, smallest and largest of the numbers. Use the techniques shown in Fig. 2.15. The calculation of the average in this exercise should result in an integer representation of the average. So, if the sum of the values is 7, the average should be 2, not 2.3333…..
Fig. 2.15
Transcribed Image Text:
System.out.print("Enter first integer: "); // prompt int number1= input.nextInt(); // read first number from user System.out.print("Enter second integer : "); // prompt int number2 = input.nextInt(); // read second number from user if (number1== number2) System.out.printf("%d ==%d%n", number1, number2); } if (number1 != number2) { System.out.printf ("%d != %d %n", number1, number2); } if (number1 < number2) { System.out.printf(("%d < %d%n", number1, number2); } if (numberl> number2) { } if (number1 = number2) { System.out.printf("%d >= %d %n", numberl, number2); System.out.printf("%d > %d %n", numberl, number2); } } // end method main. } // end class Comparison Enter first integer: 777 Enter second integer: 777 777 == 777 777 = 777 Enter first integer: 1000 Enter second integer: 2000 1000 2000 1000 2000 1000 < 2000 Enter first integer: 2000 Enter second integer: 1000 2000 1000 2000 1000 2000 1000
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 100% (QA)
The question asks for an application that takes three integer inputs from the user and then displays ...View the full answer
Answered By
David Muchemi
I am a professional academic writer with considerable experience in writing business and economic related papers. I have been writing for my clients who reach out to me personally after being recommended to me by satisfied clients.
I have the English language prowess, no grammatical and spelling errors can be found in my work. I double-check for such mistakes before submitting my papers.
I deliver finished work within the stipulated time and without fail. I am a good researcher on any topic especially those perceived to be tough.
I am ready to work on your papers and ensure you receive the highest quality you are looking for. Please hire me to offer my readily available quality service.
Best regards,
4.60+
27+ Reviews
61+ Question Solved
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Question Posted:
Students also viewed these Computer science questions
-
Heres a peek ahead. In this chapter, you learned about integers and the type int. Java can also represent floating-point numbers that contain decimal points, such as 3.14159. Write an application...
-
Let F(z, y) = 7(z + y) i + 5 sin(y) j. Find the tine integral of F around the perimeler of the rectangie with comers (4,0). (4,2). (-1,2). (-1,0). traversed in that order.
-
Class Median Midpoint, x Income, I 19.5 $12,965 An individual's income varies with age. The table shows the median income I of individuals of different age groups within the United States for a...
-
(Two Differences, One Rate, Beginning Deferred Balance, Compute Pretax Financial Income) Shamess Co. establishes a $90 million liability at the end of 2010 for the estimated litigation settlement for...
-
A simply supported 20-foot beam supports a uniformly distributed load of 1000 pounds per foot. The bending moment M (in foot-pounds) x feet from one end of the beam is given by M = 500x(20 x). (a)...
-
If your instructor assigns a marketing plan for your class, we hope you will be excitedfor two reasons. First, you will get insights into trying to actually do marketing that often go beyond what you...
-
At December 31, 2011, the records of NCIS Corporation provided the following selected and incomplete data: Common stock (par $10; no changes during the year). Shares authorized, 200,000. Shares...
-
In establishing a new herb farm, your employer has asked you to estimate the bulk density of the farm's soil. Here are the raw data you have assembled using five relatively undisturbed soil cores...
-
What does the following code print? System.out.printf(" ****%n ******%n*******%n ******%n ****%n");
-
Write an application that asks the user to enter one integer, obtains it from the user and displays whether the number and its square are greater than, equal to, not equal to, or less than the number...
-
At December 31, 2011, Kardashian Company had a balance of $15,000 in Allowance for Doubtful Accounts. During 2012, Kardashian wrote off accounts totaling $13,000. One of those accounts ($1,800) was...
-
Describe four basic rules of ASC 815 Derivatives and Hedging.
-
Calculate the following cross exchange rates: a. If exchange rates are S $ = 200$ and S $SFr = $0.50SFr, what is the S SFr exchange rate? b. The dollar is trading at S $ = 100$ and S SFr$ = SFr1.60$....
-
Industrial Bank of China is earning a nominal yuan return of 7.1 percent on a commercial loan. Expected inflation in CNY is 5 percent. What is the expected real return in yuan? (Be precise.)
-
Suppose the spot rate is 105/$ and there is an equal chance that it will fall to 70.38$ or rise to 156.64$. To what continuously compounded rates of return do these changes correspond?
-
What is the FHA 242 program?
-
David Patton, a merchandising manager for J.C. Penney Company, was having an intimate relationship with a co-worker. The store manager, McKay, told Patton that if he did not cease this relationship...
-
What is a lobbyist in US? How did this term emerge?
-
You are trying to bake 3 blueberry pound cakes. Cake ingredients are as follows: 1 cup butter, softened 1 cup sugar 4 large eggs 1 teaspoon vanilla extract 1/2 teaspoon salt 1/4 teaspoon nutmeg 1 1/2...
-
Many computer applications involve searching through a set of data and sorting the data. A number of efficient searching and sorting algorithms have been devised in order to reduce the runtime of...
-
Consider the following piece of C code: for (j=2;j <1000;j++) D[j] = D[j1]+D[j2]; Th e MIPS code corresponding to the above fragment is: Instructions have the following associated latencies (in...
-
1.1 Write an essay that discuss the key factors that drive mergers and acquisitions (M&A) in today's business environment. Evaluate their impact on organizational growth and competitiveness. Provide...
-
Find the probability of products being delivered to the retailer given that there are no capacity constraints at any supply chain stages or transportations. The probability of failure is listed next...
-
So, the market will not compensate me for not doing what a rational investor could-and should-do. Is that right? IZZY: That is absolutely correct. The fact that you, as an investor, do not choose to...
Study smarter with the SolutionInn App