Write the following code A class named Arithmetic with a method named add that takes integers as parameters and returns an integer denoting their sum. A class named Adder that inherits from a superclass named Arithmetic & overwrite add method.         Input Format: calling the add method on an Adder object and passing it integer parameters

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

please solve (Java problem using class inheritence and encapsulation)

  1. Write the following code
  • A class named Arithmetic with a method named add that takes integers as parameters and returns an integer denoting their sum.
  • A class named Adder that inherits from a superclass named Arithmetic & overwrite add method.

        Input Format: calling the add method on an Adder object and passing it integer parameters.

2.Create a class called Employee whose objects are records for an employee. This class will be a derived class of the class Person. An employee record has an employee's name (which is a private property and inherited from the class Person), an annual salary represented as a single value of type double & private property, a year the employee started work as a single value of type int and a national insurance number, which is a value of type String & private property of the Employee class. Write another class containing a main method to fully test your class definition.

3.Create a class called Bank which contains bank’s name, address, number of branch of that bank. Usually a bank has different scheme like savings account, fixed deposit, DPS. All scheme has different interest rate like 4%, 6%, and 4.5%. Write class for each scheme which inherit bank class & must implement a method which calculate amount including interest rate based on any amount. 

4.Create an class named Pet which contains 3 method named getName(), setName() & play(). Create a class named Cat that inherit Pet class & contains a method named eat(). Create another class named Fish that also inherit Pet class & override play() ethod. Write a test application that demonstrates each class’s capabilities.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY