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

Modify the program by adding another method to be called for the

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

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!