Using java, This program should read in a two-digit integer from the command-line and print out the sum of its digits. The program should use a method sumOfDigits() that takes a two-digit integer as an input and prints out the sum of its digits. The main should only read in the run argument, translate it to an int, and call the method sumOfDigits() with that integer as an input. =================================== e.g. Given a command-line argument 77, your program should output: Your number is 77. The sum of its digits is 14. and given a run argument 39, your output should be: Your number is 39. The sum of its digits is 12.

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Using java, This program should read in a two-digit integer from the command-line and print out the sum of its digits. The program should use a method sumOfDigits() that takes a two-digit integer as an input and prints out the sum of its digits. The main should only read in the run argument, translate it to an int, and call the method sumOfDigits() with that integer as an input. =================================== e.g. Given a command-line argument 77, your program should output: Your number is 77. The sum of its digits is 14. and given a run argument 39, your output should be: Your number is 39. The sum of its digits is 12.

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,