Question: Write a java program that contains 2 classes as follow: 1 - Niven class: it contains a method called IsNiven which returns true if the

Write a java program that contains 2 classes as follow:
1- Niven class: it contains a method called IsNiven which returns true if the passed integer is Niven number, or false if the passed integer is not a Niven number.
2- NivenFile class: it reads numbers from a file named numbers.dat. and check whether the number is Niven or not by calling IsNiven method, if the number is Niven store it in a file named niven.dat, else store it in a file named nonniven.dat.
Note: A Niven number is any whole number that is divisible by the sum of its digits. For example, 126 is a Niven number because the sum of its digits 1+2+6, is 9.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!