About the application program
Write an application program that declares one OneNumber object and one TwoNumber object. (You will also need to declare other variables.) The program should ask the user to enter the input filename and the output filename (use the Scanner class or JOptionPane). The main method should contain a while loop that reads data from the input file. The loop should terminate when there is no more data in the file. The OneNumber object should call appropriate accessor/mutator methods and each of the additional methods required for this particular class. The TwoNumber object should call appropriate accessor/mutator methods and each of the additional methods required for this particular class. The program should output to a file the value(s) of the field(s) and the results of the unique class methods (isPrime, sumOfDigits, divisibleByNine or greatestCommonFactor, sumBetweenNumbers). Make sure that each part of the output is properly labeled and easy to read.
About the first class
Write a class named OneNumber that has one integer field. Use only while or for loops.
You should only exit from a loop by a false loop condition —no exit or breaks allowed. The data is numeric – do not use Strings.
Two constructors: the default constructor and one constructor with one parameter,
Standard mutator and accessor methods,
isPrime – This method should determine if the number read from the file is a prime number, (A prime number is a number divisible by itself and 1.)
sumOfDigits – This method should find the sum of the digits of the number read from the file. (For example: the number 123 would add 1 + 2 + 3 to get 6).
divisibleByNine – This method should determine if the number read from the file is divisible by 9. (Use the fact that a number is divisible by nine when the sum of the digits is divisible by nine.)
About the second class
Write a class named TwoNumber.that has two integer fields. Use only while or for loops. You should only exit from a loop by a false loop condition—no exit or breaks allowed. The data is numeric – do not use Strings.
Two constructors: the default constructor and one constructor with two parameters,
Standard accessor and mutator methods.
greatestCommonFactor – This method should find the largest number that can be divided into the two numbers read from the file.
sumBetweenNumbers – This method should add all of the numbers between the two numbers read from the file (include the numbers read). For example: if the numbers were 5 and 9 then the method would add 5 + 6 + 7 + 8 + 9 to get 35.
Data Files:
Copy the data files from eCampus to your storage device.
Explanation of Data Files:
1 //this number tells you to use class OneNumber
27 // use this number to create a OneNumber object
1 //this number tells you to use class OneNumber
1000 //use this number to create a OneNumber object
2 //this number tells you to use class TwoNumber
300 //use this number and the next one to create a TwoNumber object
700
2 //this number tells you to use class TwoNumber
5 //use this number and the next one to create a TwoNumber object
9
… //and the file continues
I posted the assignment so you can hopefully help me by using it as a reference.
Main:
Not sure what to do now.
OneNumber class:
Did I do this class right?
TwoNumber class:
On this class I am not sure how to find the GCD. Also, not sure if my sumBetweenNumbers is correct since the numbers will be coming from a file.