Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

  1. Convert x to base 8, call this p
  2. Sort the digits of p in increasing order, call this q
  3. Subtract q from p in octal (convert q and p to decimal, subtract and convert back to octal)
  4. Repeat steps 2 - 3, four more times or until the digits in the result are in sorted order.
  5. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excellence in Business Communication

Authors: John V. Thill, Courtland L. Bovee

9th edition

136103766, 978-0136103769

More Books

Students also viewed these Programming questions

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago

Question

Define Management by exception

Answered: 1 week ago