Question: Class MyNum : This class needs to provide the following information: A Number represents the Total number of instantiated Objects from this class. A Number

Class MyNum:

This class needs to provide the following information:

A Number represents the Total number of instantiated Objects from this class.

A Number represents number of times methods was called from this class across all objects.

A double, int, short, and byte.

All Store the same value provided in the constructor.

Class provides the following constructors:

Default

Sets the above variables to the defaults values.

With an Argument: A double.

Save the double value into all the above variables.

Class provides the following methods Notice the overrided methods:

boolean check_is_even();

Check if number is even, return true, otherwise false.

void print_number();

Print the number stored in Object

void print_number(int i);

Print the number i

void print_number_Hex();

Print the number stored in Object in hex

void print_number_Hex(int i);

Print the number stored in Object in hex

void print_number_Octal();

Print the number stored in Object in octal format

void print_number_Octal(int i);

Print number i in octal format

The MyNum class implements the Num_Operations interface. (Check Below)

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

NumOperations interface:

Interface defines the following methods:

boolean check_palindrome(int num);

A palindrome is a word, number, or other sequence of characters which reads the same backward as forward. For example the number 121 and 3553 are palindrome.

boolean check_prime(int num);

A prime number is a number greater than 1 that cannot be formed by multiplying two smaller natural numbers. For example 2, 3, 5, 7, 11, 13 are prime number.

int factorial_num(int num);

The factorial of a non-negative integer n n!: is the product of all positive integers less than or equal to n. For example, 5 ! = 5 4 3 2 1 = 120.

int num_of_digits(int num);

Num_of_Digits return the number of digits in an integer. For example: the number 123 has 3 digits.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Class Main :

class Main implements the following methods:

main method:Ask user to input a number until the value of -1 is entered

Calls all operations in class MyNum using that number

Prints the result of these operations.

After the user inputs -1, main method will call and display the result of List_Numbers

List_NumbersDisplays the list of all input numbers that the user supplied to this program.Hint: you can use String concatenations for this operation

oldnumbers+" "+current_number.

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!