Question
Hey! So for one of my programs, I have to write a main method, but I'm having some trouble.. Main method instructions: An octonumero of
Hey!
So for one of my programs, I have to write a main method, but I'm having some trouble..
Main method instructions: An octonumero of a number x is found as follows.
- Convert x to base 8, call this p
- Sort the digits of p in increasing order, call this q
- Subtract q from p in octal (convert q and p to decimal, subtract and convert back to octal)
- Repeat steps 2 - 3, four more times or until the digits in the result are in sorted order.
- Convert the number back to decimal
Can you show me how to call my methods and write the main method?
These are the list of methods I've used already in my program:
public static int decToOctal (int num)
public static int octalToDec (int num)
public static int reverseDigits (int num)
public static int[] numToArray (int num)
//Precondition: 999 < num < 10000. Assume num is a 4 digit number
public static int[] sortArray (int[] unsorted)
public static int arrayToNum ( int[] arr )
public static int octalSubtract (int larger, int smaller)
public static void main (String [] args)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started