Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions