Write a java program that prompts user to enter two integer numbers and print the sum....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a java program that prompts user to enter two integer numbers and print the sum. Then, ask the user if he want to do this again. If he answers yes, repeat the input operation and the sum again. Sample Run: Enter a number: 2 Enter another number: 4 The sum is: 6 Do you want to do this again? Y Enter a number: 5 Enter another number: 3 The sum is: 8 Do you want to do this again? N Thank you for using our program. Question Two: Write a java program that does the following: 1- Define a matrix called cat of the size (nx n ). and let the user enters its values by using while loop. 2- Define a one dimension array called lab, so that its size is the number of non-diagonal elements in the previous matrix cat. (2 marks) 3- The array lab entries should be the non-diagonal elements in the previous matrix cat. 4- Print out the third large number of array lab. Write a java program that prompts user to enter two integer numbers and print the sum. Then, ask the user if he want to do this again. If he answers yes, repeat the input operation and the sum again. Sample Run: Enter a number: 2 Enter another number: 4 The sum is: 6 Do you want to do this again? Y Enter a number: 5 Enter another number: 3 The sum is: 8 Do you want to do this again? N Thank you for using our program. Question Two: Write a java program that does the following: 1- Define a matrix called cat of the size (nx n ). and let the user enters its values by using while loop. 2- Define a one dimension array called lab, so that its size is the number of non-diagonal elements in the previous matrix cat. (2 marks) 3- The array lab entries should be the non-diagonal elements in the previous matrix cat. 4- Print out the third large number of array lab.
Expert Answer:
Answer rating: 100% (QA)
Answer Certainly Below are the Java programs for both questions Question One import javautilScanner ... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
Explain why global production and supply chain management decisions are of central importance to many global companies.
-
You have now been asked to work with a textile startup business that your firm has just taken on as a client. The business is particularly in need of support and guidance with budgeting and how it...
-
Find the intervals of increasing and decreasing for: f(x) = x4-2x3
-
In a recent study, Americans stated that they were willing to pay $70 billion to protect all endangered species and also stated that they were willing to pay $15 billion to protect a single species....
-
Consider the following sample data: a. Calculate and interpret rs. b. Specify the competing hypotheses to determine whether the Spearman rank correlation coefficient differs from zero. c. At the 5%...
-
Coins A coin is to be tossed 36 times. 1. What are the mean and standard deviation of the number of heads? 2. Suppose the resulting number of heads is unusual, two standard deviations above the mean....
-
The following is the adjusted trial balance of Qwik Care Clinic, Inc., for December 31,2010. Requirement 1. Journalize the closing entries at December 31. Qwik Care Clinic, Inc. Adjusted Trial...
-
Desrosiers Ltd. had the following long-term receivable account balances at December 31, 2016: Notes receivable .................................................. $1,800,000 Notes receivable-Employees...
-
Oahu Inc. is considering an investment in new equipment that will be used to manufacture a smartphone. The phone is expected to generate additional annual sales of 3,300 units at $276 per unit. The...
-
The following is Edge Sports Repair Shop's trial balance at September 30, 2014, the company's fiscal year end: Additional information: 1. Service revenue earned but not recorded at September 30,...
-
Dreamz Inc. develops software and learning solutions for clients worldwide. The main office of the organization is located on six floors of a building in Chicago where hundred users occupy each...
-
What is rapid application development (RAD)?
-
Why is model-driven development popular?
-
The reserve replacement ratio is somewhat problematic, since it does not reflect which of the following? a. The quantity of reserves replaced b. The time value of money c. The value of the reserve...
-
Of the many different reasons that projects fail, what is the major cause of project failure?
-
Which of the following disclosures must be reported by geographic area? a. The average sales price (including transfers) per unit of oil produced and of gas produced b. The average production cost...
-
Of the following, which one affects cash during a period? Multiple Choice The declaration of a stock dividend. O Writing off an uncollectible account receivable. The declaration of a cash dividend. O...
-
3M Company reports the following financial statement amounts in its 10-K report: a. Compute the receivables, inventory, and PPE turnover ratios for both 2018 and 2017. (Receivables turnover and...
-
Show that an executable statement enclosed in a multiline commentdelimited by /* and */does not execute.
-
Recreate your solution for Exercise 15.5 using XML serialization. You may want to create applications to read the data stored in the .xml filesthe code in Section 15.5.2 can be modified for this...
-
Write an application that reads five integers and determines and prints the largest and smallest integers in the group. Use only the programming techniques you learned in this chapter.
-
Have you experienced artistic portrayals of your own culture or identity that you find offensive? If so, do you think they should be censored? The statue of President Theodore Roosevelt flanked by an...
-
What is the core approach to an anthropology of art?
-
Describe some of the reasons that people make art and give examples of symbolism and ritual in art.
Study smarter with the SolutionInn App