subject

Write and test a Java project that satisfies the following requirements:Create a class definition file and a test driver file as follows:Create a class to hold and manipulate data for a Pet for a pet adoption service. The class will have these fields:pet type (a String)pet name (a String),cost to adopt(a double)Write the following methods for the Pet class:A default (no-args) constructorA constructor with parameter values for all the fieldA toString( ) method that uses all the fields. An equals( ) method that is based on both the pet type and pet nameA compareTo( ) method that is based only on the cost to adoptOnce the Pet class compiles write a Driver class with the main( ) method. The main( ) method will declare three Pet reference variables. It will then create the Pet objects reading the data from the file named rescue. txt. The file is comma delimited. (use the StringTokenizer class- example is posted on Canvas and was assigned for Activity 5). Use the data read in to send to the Pet constructor. NOTE WELL: The StringTokenizer method nextToken( ) returns a String. To send the cost valueto the Pet constructor you must convert this field to a double. TO do this here is an example: strCost = stok. nextToken( ); doubleCost = Double. parseDouble(strCost);After the objects have been created print the state of the three Pet objects using the toString( ) method. Test the equals( ) method using the first Pet object and the second Pet object. Test the compareTo( ) method by using the first Pet object and the third Pet object. Print the results of these two tests. Be sure your print statements are clearly labeled so it is obvious what was tested.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:10
3. bob is arguing that if you use output feedback (ofb) mode twice in a row to encrypt a long message, m, using the same key each time, it will be more secure. explain why bob is wrong, no matter what encryption algorithm he is using for block encryption (15 points).
Answers: 3
question
Computers and Technology, 22.06.2019 18:00
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
What is the term for water wave that is created by an underwater earthquake
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut off on an hev are both colored orange
Answers: 1
You know the right answer?
Write and test a Java project that satisfies the following requirements:Create a class definition fi...
Questions
question
Mathematics, 10.11.2020 21:50
question
Mathematics, 10.11.2020 21:50
question
Mathematics, 10.11.2020 21:50
Questions on the website: 13722365