Hey! So for one of my programs, I have to write a main method, but I'm having
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 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)
Excellence in Business Communication
ISBN: 978-0136103769
9th edition
Authors: John V. Thill, Courtland L. Bovee