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: 50% (2 reviews)
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...
-
For this prompt, consider your academic goals, including (but not limited to) such topics as how you plan to manage your time to fit in your studies; how you will build your skills, as needed; how...
-
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...
-
Gull Company purchased the net assets of Hart Company on January 1, 2011, and made the following entry to record the purchase: Make the required entry on January 1, 2013, for each of the following...
-
How does your schools HR department disseminate information about job openings, labor laws, and employee policies? What channels do they use to provide people with this information? Are the...
-
Assume that EBV and Talltree invested in Newco at the terms in Exercises 10.2 and 10.3, and it is now one year later. Owl is considering a $20M Series C investment in Newco. Talltree proposes to...
-
Construct a loan amortization table for a 20-year fixed rate mortgage with annual interest rate of 3.6%. The amount borrowed is $500,000. In addition, compute the WAL (weighted average life) of the...
-
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...
-
Describe how the fumarate produced by the purine nucleotide cycle could be catabolized to CO2.
-
A displacement of 32 cm east is followed by displacements of 48 cm east and then 64cm west. What is the total displacement? At 3:00 p.m. a car is located 20 km south of its starting point. One hour...
-
Consider the following Demand curve for Uber Rides: Q = = 120 - 4p Suppose that the Supply Curve is perfectly elastic at a price of $20 per unit. 11. Draw both the Supply and Demand functions with Q...
-
You've decided to build a radio to listen to your favourite FM radio station, which broadcasts at 101.5 MHz. For the tuner, you'll be using an RLC circuit, but the only inductor you happen to have on...
-
You are the lead buyer for a large healthcare organization in British Columbia and have been tasked with leading the procurement of a new CAT Scan Machine. Outline four steps to prepare and call a...
-
A circuit is composed of a coil having N turns and area A. Its leads are connected to a combination of resistors, as shown in (Figure 1). All three resistors have the same resistance R. The coil is...
-
Write an equivalent expression without negative exponents. (a) 3-7 (b) 1 / (5.9)-4 (c) x-5 / y-4
-
How does health insurance risk differ from other types of insurance risk (e.g., automobile or homeowners insurance)? What is the difference between cost sharing and cost shifting? Is retiree health...
-
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...
-
Cash from Operating Activities: ______________ Cash from Investing Activities: ______________ Cash from Financing Activities: ______________ Problem 2: Financial Ratios The GAP Macys 1 Current Ratio...
-
On January 1, 2021, Winky Enterprises issued 12% bonds dated January 1, 2021, with a face amount of $2,800,000. The bonds mature in 2030 (10 years). For bonds of similar risk and maturity, the market...
-
Using the following accounts and balances, prepare the stockholders' equity vection of the balance sheet. Pilty thousand shares of common stock are authorised, and 1,000 shares have been recoured,...
Study smarter with the SolutionInn App