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 21:00
So im doing this school challenge and the teachers said whats the average text a student gets a day so i need to get about 20 in a day but dont know how can you guys 2163371293
Answers: 2
question
Computers and Technology, 23.06.2019 00:10
My has been slow anyone else’s ?
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
How do you set up a slide show to play continuously, advancing through all the slides without requiring your interaction? a. click set up slide show, and then select the loop continuously until ‘esc' and show without narration options. b. click set up slide show, and then select the loop continuously until ‘esc' and use timings, if present options. c. click set up slide show, and then select the show presenter view and use timings, if present options. d. click set up slide show, and then select the show without animation and browsed at a kiosk (full screen) options.
Answers: 3
question
Computers and Technology, 23.06.2019 20:50
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
You know the right answer?
Write and test a Java project that satisfies the following requirements:Create a class definition fi...
Questions
question
English, 08.09.2021 08:20
question
Biology, 08.09.2021 08:20
question
Mathematics, 08.09.2021 08:20
question
Mathematics, 08.09.2021 08:30
question
Social Studies, 08.09.2021 08:30
question
Chemistry, 08.09.2021 08:30
question
English, 08.09.2021 08:30
Questions on the website: 13722363