Java Programming
Java Programming
9th Edition
ISBN: 9780357616635
Author: Joyce Farrell
Publisher: CENGAGE L
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}}
For your homework assignment, build a simple application for use by a local retail store. Your program should have the following classes: Item: Represents an item a customer might buy at the store. It should have two attributes: a String for the item description and a float for the price. This class should also override the __str__ method in a nicely formatted way. Customer: Represents a customer at the store. It should have three attributes: a String for the customer's name, a Boolean for the customer's preferred status, and a list of 5 indexes to hold Item objects. Include the following methods: make_purchase: accepts a String and a double as parameters to represent the name and price of an item this customer is purchasing. Create a new Item object with this info and append it to the internal list. If the customer is a preferred customer based on the Boolean attribute's value, take 10% off the total sale price. __str__: Override this method to print the customer's name and every…
This code is in java. Transportation Program   Main file called transportation. It will create the sedan and coupe objects. You will pass in parameters for the number of exterior and interior color options.   It will print a message from the car class that prints  All cars have Wheels: #of wheels. ; Interior Color Options: # of interior colors ; Exterior Color Options: # of colors. A message from the sedan and the coupe classes that print the number of doors and cylinders.   The car class is the parent class. It will have a constructor for the number of wheels (4), exterior colors (5), and interior colors (2).   It will also have a method that prints the text.   The sedan and coupe classes will be children classes to the car class.  They will have a constructor that calls the car’s constructor and adds in variables for the number of doors and number of cylinders.   sedans have 4 doors and 6 cylinder engines. coupes have 2 doors and 4 cylinder engines.   The sedan and coupe classes will…
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
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT