Question: Write an application with the following features: Create a class called Owner Private fields: firstName, lastName, petName, password Accessor and mutators for the private fields

  1. Write an application with the following features:
    1. Create a class called Owner
      1. Private fields: firstName, lastName, petName, password
      2. Accessor and mutators for the private fields
      3. A constructor that accepts 3 parameters: firstname, lastname, and petname
    2. Create a class called PetApp
      1. Must have public static void main
      2. Method:public static Owner[] getOwners(String filename)
        1. reads the contents of the file, stores the data in an array, and return the array

Owner [] yourvariable

Since you do not know how many rows you have in the file, you need to find an algorithm that would solve that. Do not use ArrayList. You can create additional methods as needed.

    1. make sure to close the file before the return
  1. Method:public static void generatePassword(Owner[] data)
    1. Generates a password for every owner and store in the private field password
    2. Temporary password:

first 3 characters of the lastName + first 2 characters of the firstName + _ + random

random number: between 1 and 200 (inclusive)

  1. Implement method overloading.
    1. One method to display the firstName, lastName, and PetName
    2. Another method to display firstName, lastName, and Password
    3. Method name: display (you determine the appropriate parameters)

Your code must also include calls to the different methods mentioned above to test that they are working.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!