Question: DESCRIPTION Complete the method welcome() and create and complete the method goodbye() to print a welcome message and a goodbye message to the user, given

DESCRIPTION

Complete the method welcome() and create and complete the method goodbye() to print a welcome message and a goodbye message to the user, given their name. The main() method has already been completed and gets the user's name from input. The main() method then calls the welcome() and goodbye() methods to print the two messages.

Your task is to complete the welcome() method that has already been started for you and to create and complete a goodbye() method, as described in the comments.

import java.util.Scanner; public class Messages { public static void main(String[] args) { //get the user's name System.out.println("What is your name?"); Scanner scnr = new Scanner(System.in); String name = scnr.nextLine(); //call the methods below to print a welcome message and a goodbye message welcome(name); goodbye(name); } //end main /* * complete the method below to print a welcome message: * "Welcome to the program, !" * where is replaced with the String parameter containing the user's name */ public static void welcome(String name) { //TODO: complete the body code of the method welcome() } //end welcome /* * complete the method below to print a goodbye message: * "Goodbye, ." * where is replaced with the String parameter containing the user's name */ //TODO: create and complete the method goodbye() } //end Messages

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!