Write a program that prompts the user to enter an integer (n) and a sum value...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that prompts the user to enter an integer (n) and a sum value (s). The program checks the value of (n + n), if it is less than or greater than the entered sum (s), the program finds the needed value to be added to or subtracted from (n + n) in order to reach the given sum (s) and displays it, otherwise it displays that n +n = sum. Sample Run1: Enter an integer: 5 Enter a sum: 25 You need to add 15 to reach the sum. Sample Run2: Enter an integer: 8 Enter a sum: 6 You need to subtract 10 to reach the sum. Sample Run3: Enter an integer: 7 Enter a sum: 14 7 + 7 = 14. Java langauge using looop Write a program that prompts the user to enter an integer (n) and a sum value (s). The program checks the value of (n + n), if it is less than or greater than the entered sum (s), the program finds the needed value to be added to or subtracted from (n + n) in order to reach the given sum (s) and displays it, otherwise it displays that n +n = sum. Sample Run1: Enter an integer: 5 Enter a sum: 25 You need to add 15 to reach the sum. Sample Run2: Enter an integer: 8 Enter a sum: 6 You need to subtract 10 to reach the sum. Sample Run3: Enter an integer: 7 Enter a sum: 14 7 + 7 = 14. Java langauge using looop
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner importing Scanner class public class Main public static v... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Write a program that prompts the user to enter an integer m and find the smallest integer n such that m * n is a perfect square. (Hint: Store all smallest factors of m into an array list. n is the...
-
Write a program that prompts the user to enter an integer for todays day of the week (Sunday is 0, Monday is 1, . . . , and Saturday is 6). Also prompt the user to enter the number of days after...
-
Write a program that prompts the user to enter an integer between 0 and 15 and displays its corresponding hex number. For an incorrect input number, display invalid input. Here are some sample runs:...
-
9) The mole (Avogadro number N) is defined as the number of atoms in exactly 12 grams of 2C, calculate the: a) number of atoms in 2 g of C b) number of atoms in 5 g of C
-
Florences Floral Arrangements, Inc. had the following transactions in the month of January: The owners invested $ 100,000 (the par value of the stock) for 20,000 shares of common stock; the company...
-
(a) use a graphing utility to graph the function, (b) approximate the open intervals on which the function is increasing, decreasing, or constant, (c) Determine whether the function is even, odd, or...
-
Measure context switching overhead on an operating system.
-
Equipment replacement, income taxes (continuation of 21-27). Assume the same facts as in Problem 21-27, except that the plant is located in Austin, Texas. Pro Chips has no special waiver on income...
-
Suppose that increases because households have developed a greater preference for leisure relative to consumption. Construct a pair of well-labeled diagrams of equilibrium in the factor markets to...
-
On January 1, 2024, Tennessee Harvester Corporation issued debenture bonds that pay interest semiannually on June 30 and December 31. Portions of the bond amortization schedule appear below:...
-
Under the Bretton Woods system the following currencies were directly tied to gold the British Pound the US Dollar O the Thai baht All of the above were directly tied to gold
-
Sam is a sole proprietor and is a cash-basis taxpayer. He is forming Mark Co. One of the assets he will contribute as part of a Code Sec. 351 transfer is accounts receivable. What basis will Mark Co....
-
Matthew, a sole proprietor, employs Timothy as his full-time employee. Timothy's 2018 tax return is being audited by the IRS. Because of Timothys high regard for Matthew's knowledge and judgment,...
-
Which of the following publications includes the regular decisions of the United States Tax Court? a. Federal Register b. Internal Revenue Bulletin c. United States Tax Court Reports d. Tax Court...
-
Unreported interest income on U.S. government bonds owned by a decedent at the date of death can be handled in various ways for tax purposes. List and discuss the various ways.
-
Ron mailed his 2018 federal tax return on April 15, 2019, attaching only a first-class postage stamp. However, the postage should have been higher since the return weighed three ounces. His return is...
-
10:04 File Details Business Communications (BUSO-10... Table 6.6 Common Errors in English 184 Business Communication for Success 1. accept or except 2. affect or effect 4. its or it's 5. lay or lie...
-
Which of the following gives the range of y = 4 - 2 -x ? (A) (- , ) (B) (- , 4) (C) [- 4, ) (D) (- , 4] (E) All reals
-
How many Swing user-interface components are there? Look at the Java documentation to get an approximate answer.
-
A supermarket awards coupons depending on how much a customer spends on groceries. For example, if you spend $50, you will get a coupon worth eight percent of that amount. The following table shows...
-
The nested loops for (int i = 1; i
-
What role does the HAL play in the platform?
-
If your logic analyzer is capable of on-the-fly disassembly, use it to display bus activity in the form of instructions, rather than simply 1s and 0s.
-
Draw UML state diagrams for device 1 and device 2 in a four-cycle handshake.
Study smarter with the SolutionInn App