Wj 1103a Module 3 Exercise2

  • Uploaded by: Rajani Ramsagar
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Wj 1103a Module 3 Exercise2 as PDF for free.

More details

  • Words: 176
  • Pages: 1
Exercise 2: Using Overloaded Methods The objective of this exercise is to write a method that is overloaded several times.

Task 1 – Developing a Class With an Overloaded Method In this task, you write a class with an overloaded method. Follow these steps to write your class: 1. Go to the methods directory. 2. Create a class called Customer.java. 3. Within the Customer.java class, add an overloaded method called setCustInfo. Depending on how the setCustInfo method is called, it does one of the following: •

Sets the ID, name, address, and phone number for a Customer object (this is the minimum information needed for a new Customer).



Sets the ID, name, address, phone number, and email address for a Customer object.

4. Create a new test class called CustomerTest. 5. In the main method: a. Create two object references to different Customer objects. b. Use each variation of the setCustInfo method to provide information for each Customer object. Display the contents of each Customer object. 6. Compile your classes and execute your CustomerTest program.

Related Documents


More Documents from "Rajani Ramsagar"