JAVA PROGRAMMING LANGUAGE. LESSON: INHERITANCE. PLEASE USE A SCANNER TO GET INPUT FROM USERS. THE SAMPLE OUTPUT
Fantastic news! We've Found the answer you've been seeking!
Question:
JAVA PROGRAMMING LANGUAGE. LESSON: INHERITANCE. PLEASE USE A SCANNER TO GET INPUT FROM USERS. THE SAMPLE OUTPUT IS ONLY AN EXAMPLE OF WHAT IT SHOULD LOOK LIKE. THE NUMBERS USED IN THE PHOTO SHOULDN'T BE THE ONES USED IN THE PROGRAM, RATHER THE USER WILL INPUT THE NUMBERS THEMSELVES.
Transcribed Image Text:
YOUR FINAL TASK COMPUTER PROGRAMMING 2 (Week 10) NAME: TEACHER: GRADE & SECTION: DATE SUBMITTED: Instructions: • • Create a program the will show inheritance by following the steps. Create a superclass A that will show the integer values of i and j. Create a subclass B by extending the superclass A that will show the value of k and the sum of the values i + j + k through methods. • Create a main class named Inheritance_YourLastname that will instantiate objects named superOb from class A and subob from class B. • • In the main class, the user will be ask to input the values of i and j that will be used in the superclass A and another i, j, and k that will be used in the subclass B. This will print the following statements below if the values of i and j in superOb is 10 and 20 consecutively and the values of i, j, and k in subob is 7,8, and 9 consecutively. Sample Output: Enter the value of i in superOb: 10 Enter the value of j in superOb: 20 Enter the value of i in subob: 7 Enter the value of j in subob: 8 Enter the value of k in subob: 9 Contents of superOb: i and j: 10 20 Contents of sub0b: i and j: 78 k: 9 Sum of i, j, and k in subob: i+j+k: 24 YOUR FINAL TASK COMPUTER PROGRAMMING 2 (Week 10) NAME: TEACHER: GRADE & SECTION: DATE SUBMITTED: Instructions: • • Create a program the will show inheritance by following the steps. Create a superclass A that will show the integer values of i and j. Create a subclass B by extending the superclass A that will show the value of k and the sum of the values i + j + k through methods. • Create a main class named Inheritance_YourLastname that will instantiate objects named superOb from class A and subob from class B. • • In the main class, the user will be ask to input the values of i and j that will be used in the superclass A and another i, j, and k that will be used in the subclass B. This will print the following statements below if the values of i and j in superOb is 10 and 20 consecutively and the values of i, j, and k in subob is 7,8, and 9 consecutively. Sample Output: Enter the value of i in superOb: 10 Enter the value of j in superOb: 20 Enter the value of i in subob: 7 Enter the value of j in subob: 8 Enter the value of k in subob: 9 Contents of superOb: i and j: 10 20 Contents of sub0b: i and j: 78 k: 9 Sum of i, j, and k in subob: i+j+k: 24
Expert Answer:
Answer rating: 100% (QA)
Sure heres a Java program that demonstrates inheritance and uses a Scanner to get input from users i... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Your task is to build upon your calendar from Assignment 1 to fix a few things and add more functionality to your program. (****************************************** HERE IS ASSIGNMENT 1 THAT WE ARE...
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Show that an emission tax and an absolute emission standard are equivalent instruments to regulate a polluting monopolist if and only if the standard is binding.
-
Using the data in BE7.10, prepare the necessary journal entries required on July 31 for Southco. In BE 7.10 An examination of the company's July bank statement shows a balance of $19,260 on July 31;...
-
Laker Company reported the following January purchases and sales data for its only product. The Company uses a perpetual Inventory system. For specific identification, ending inventory consists of...
-
What is the default filename that make will process if no other is given?
-
Nagoya Amusements Corporation places electronic games and other amusement devices in supermarkets and similar outlets throughout Japan. Nagoya Amusements is investigating the purchase of a new...
-
The given code starts by initializing some sets and functions f , g , and h . Block 1 is a function ( called hasInverse ) that takes as input another function ( called func ) , and two sets ( D and T...
-
In Intuit QuickBooks how do I record this transaction?... Wrote check number 10010 to City Credit Union for payment of amount due (City Credit Union in the Account/Category field); $110.35.
-
Bigelow has a levered cost of equity of 14.29 percent and a pretax cost of debt of 7.23 percent. The required return on the assets is 11 percent. What is the firm's debt-equity ratio based on MM...
-
Describe the main uncertainties that are involved in a merger analysis. Are mergers an ideal activity in which to use real option valuation? Discuss some of the ways in which a real option analysis...
-
Outline the two broad methods of payment in M&A transactions. What might determine the method of payment, and what impact does this have on both the acquiring and the target firm?
-
Why would shareholders not be keen on shelf registration? What steps could they take to avoid shelf registration?
-
Many commentators have argued that differences in tax regulations, especially regarding mergers and acquisitions, have reduced the viability of this corporate activity. Do you agree with this?...
-
Loans What are the main agency issues involved in a syndicated loan? Do you think syndicated loans should be priced differently from public debt issues? Explain.
-
After looking back over the companys book, Terrys controller has become concerned that management purposely provided negative financial information to the market in the weeks before the strike price...
-
Prove the following D,(cos x) = - sin x (Hint: Apply the identity cos(A + B) = cos A cos B sin A sin B)
-
For each of the four parts of question 6, calculate the values of these areas in dollars. How much of the deadweight loss is due to the overproduction of steel by higher-cost U.S. steel producers,...
-
Why is it so painful to get rid of inflation? Why cant the government just stop printing so much money?
-
How might elasticities help to explain why people on vacation tend to spend more for food and necessities than the local population?
-
In Problem 102, using an interest rate of 10 percent, what uniform series over the closed interval [1,8] is equivalent to the cash flow profile shown? Data from problem 102 Consider the following...
-
In Problem 102, using an interest rate of 8 percent, what single sum of money occurring at the end of year 8 is equivalent to the cash flow profile shown? Data from problem 102 Consider the following...
-
Consider the following cash flow profile: With a compounded annual interest rate of 6 percent, what single sum of money at the end of the sixth year will be equivalent to the cash flow series? EOY...
Study smarter with the SolutionInn App