Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the generateFormalName method so that you return the formal name (Mr. or Ms. + last name) given a full name and gender (Strings) as

Complete the generateFormalName method so that you return the formal name (Mr. or Ms. + last name) given a full name and gender (Strings) as parameters.

--You can assume a valid name & gender (any case allowed) is passed in. Example 1: ("Bob Smith", "MaLE") passed in should generate "Mr. Smith" Example 2: ("Maggie May", "feMALE") passed in should generate "Ms. May"

Tip 1: You are given a String formalName initialized to the empty String -- you will want to concatenate other Strings onto this to produce the full formalName.

Tip 2: Write your algorithm in English first.

Tip 3: Think of all of the methods at your disposal and which could be helpful.

Given Code:

public class StringPractice {

public String generateFormalName(String fullName, String gender) { String formalName = ""; //Insert your code here: return formalName; }

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

Does competition help or hurt the valuation of a business? Explain.

Answered: 1 week ago

Question

=+Do you want to work from home?

Answered: 1 week ago

Question

=+ What skills and competencies will enable someone

Answered: 1 week ago

Question

=+to live and work wherever he or she wants?

Answered: 1 week ago