a class named “numeric” having the one attribute number and one method void set_value(int) and get_value() which sets the value of number. Create two classes square and cube that inherits the “numeric” class. Class square has a function that returns the square of a number (number is inherited from the numeric class). Class cube has function which returns the cube of a number. In the main function create object of child classes and display square and cube of a number.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 4PE
icon
Related questions
Question

Create a class named “numeric” having the one attribute number and one method void set_value(int) and get_value() which sets the value of number. Create two classes square and cube that inherits the “numeric” class. Class square has a function that returns the square of a number (number is inherited from the numeric class). Class cube has function which returns the cube of a number. In the main function create object of child classes and display square and cube of a number.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,