Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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.
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Sure heres a Java program that demonstrates inheritance and uses a Scanner to get input from users i...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started