EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
Question
Book Icon
Chapter 4, Problem 1PE
Program Plan Intro

Overloading the method

Program plan:

Filename: “FormLetterWriter.java”

  • Define the “FormLetterWriter” class
  • Define the main method.
    • Call the “displaySalutation” method with single parameter.
    • Call the “displayLetter” method.
    • Call the “displaySalutation” method with two parameters.
    • Call the method “displayLetter”.
  • Define the “displaySalutation” method
    • Display the “Dear Mr. or Ms.” followed by last name.
  • Define the “displaySalutation” method
    • Display the first name followed by last name.
  • Define the “displayLetter” method
  • Display the statement.

Blurred answer
Students have asked these similar questions
I need help! Modify the class named FormLetterWriter that includes two overloaded methods named displaySalutation(). The first method takes one String parameter that represents a customer’s last name, and it displays the salutation Dear Mr. or Ms. followed by the last name. The second method accepts two String parameters that represent a first and last name, and it displays the greeting Dear followed by the first name, a space, and the last name. After each salutation, display the rest of a short business letter using the displayLetter method: Thank you for your recent order. public class FormLetterWriter {public static void main(String[] args) {displaySalutation("Kelly");displayLetter();displaySalutation("Christy", "Johnson");displayLetter();} public static void displaySalutation(String lastName) {// Write your code here} public static void displaySalutation(String firstName, String lastName) {// Write your code here}public static void displayLetter() {// Write your code here}}
Modify the class named FormLetterWriter that includes two overloaded methods named displaySalutation(). The first method takes one String parameter that represents a customer’s last name, and it displays the salutation Dear Mr. or Ms. followed by the last name. The second method accepts two String parameters that represent a first and last name, and it displays the greeting Dear followed by the first name, a space, and the last name. After each salutation, display the rest of a short business letter using the displayLetter method: Thank you for your recent order. An example of the program is shown below: Dear Mr. or Ms. Kelly, Thank you for your recent order. Dear Christy Johnson, Thank you for your recent order.
Modify the class named FormLetterWriter that includes two overloaded methods named displaySalutation(). The first method takes one String parameter that represents a customer’s last name, and it displays the salutation Dear Mr. or Ms. followed by the last name. The second method accepts two String parameters that represent a first and last name, and it displays the greeting Dear followed by the first name, a space, and the last name. After each salutation, display the rest of a short business letter using the displayLetter method: Thank you for your recent order. An example of the program is shown below: Dear Mr. or Ms. Kelly, Thank you for your recent order. Dear Christy Johnson, Thank you for your recent order.   public class FormLetterWriter {     public static void main(String[] args) {         displaySalutation("Kelly");         displayLetter();         displaySalutation("Christy", "Johnson");         displayLetter();     }     public static void displaySalutation(String…
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage