Question: Write a program that accepts two four-digit octal numbers, converts them to decimal, adds them together, and prints both the decimal and octal result of

Write a program that accepts two four-digit octal numbers, converts them to decimal, adds them together, and prints both the decimal and octal result of that addition. You may assume the user will only give numbers that will add up to 7777, so do not worry about doing checks above that. Also built in Java methods that does this conversion automatically (such as Integer.parseInt(String,8)) WILL NOT be accepted. However, you may still use Integer.parseInt(String) to convert from a String to an integer.

Example Dialog:

Enter a 4 digit octal number

0477

Enter another 4 digit octal number

0022

The first number is 319

The second number is 18

Added together is 337

Which is 0521 in octal

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!