Question: Modify the program by adding another method to be called for the same input and add another print statement with the returned result. import java.util.Scanner;
Modify the program by adding another method to be called for the same input and add another print statement with the returned result.
import java.util.Scanner;
public class Week6Discussion { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Hello, what is your name? "); String name = scanner.nextLine(); System.out.print("Thank you, how old are you? "); int age = scanner.nextInt();
int result = calculateAgeInDogYears(age); System.out.println("Awesome, " + name + ", you are " + age + " years old, which is " + result + " in dog years!"); }
public static int calculateAgeInDogYears(int age) { int dogYears = age * 7; return dogYears; } }

9. Week6Discussion P3 mein(Stringl) : void - calculateiggelnDagYcarssint) : int Hello, what is your name? Derrick Thank you, how old are you? 35 Awesome, Derrick, you are 35 years old, which is 245 in dog years
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
