Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an octal class that ecapsulates an Octal number value. THE USE OF ARRAYS I

ID: 3540420 • Letter: W

Question

Write an octal class that ecapsulates an Octal number value. THE USE OF ARRAYS IS NOT PERMITTED. The methods the class has are: public void read(), public void set(String), public void set (int), public void set(Octal), public octal get(), public Octal add(Octal), public Octal subtract(Octal), public Octal multiply(Octal), public Octal divide(Octal), public Octal add(int), public Octal subtract(int), public Octal multipily(int), public Octal divide(int), public Octal add(String), public Octal subtract(String), public octal multiply(String), public Octal divide (String), public boolean equals(Octal), and public String toString(). Write private methods to check for valid character input, remove the base o character and set the sign. Your class must consider both positive and negative values. Your class should have at least 3 consrtuctors: a default constructor, an explicit constructor, an explicit constructor with an integer argument and an explicit constructor with a string argument.

Explanation / Answer

You can operate on octal numbers by converting them to octal from decimal. The rest of the logic goes as with decimal numbers. Here is how you would convert a decimal number to octal:


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote