Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

can someone help me, Write a method called processName that accepts a Scanner fo

ID: 3652507 • Letter: C

Question

can someone help me, Write a method called processName that accepts a Scanner for the console as a parameter and that prompts the user to enter his or her full name, then prints the name in reverse order ( last name, first name). You may assume that only a first and last name will be given. You should read the entire line of input at once with the Scanner and then break it apart as necessary. Here is a sample dialogue with the user:

Please enter your full name: Sammy Jankis
Your name in reverse order is Jankis, Sammy

Explanation / Answer

import java.util.Scanner; public class Name { public static void main(String [] args){ Scanner in = new Scanner(System.in); System.out.println(processName(in)); } public static String processName(Scanner in){ System.out.print("Please enter your full name: "); String firstName = in.next(); String lastName = in.next(); return "Your name in reverse order is: " + lastName + ", " + firstName; } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote