Answered step by step
Verified Expert Solution
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
- 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
- A constructor that accepts 3 parameters: firstname, lastname, and petname
- Create a class called PetApp
- Must have public static void main
- Method:public static Owner[] getOwners(String filename)
- 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.
- make sure to close the file before the return
- Method:public static void generatePassword(Owner[] data)
- Generates a password for every owner and store in the private field password
- Temporary password:
first 3 characters of the lastName + first 2 characters of the firstName + _ + random
random number: between 1 and 200 (inclusive)
- Implement method overloading.
- One method to display the firstName, lastName, and PetName
- Another method to display firstName, lastName, and Password
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started