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
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