Computers and Technology

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:00, smartoa
Annie is creating a corporate report for a company’s annual meeting. in the report, she wants to add the signature of various department heads. which device can annie use to capture signatures to include in the report? a. printer b. monitor c. e-reader d. digitizing tablet
Answers: 1
image
Computers and Technology, 23.06.2019 04:00, terrell31
Write a method that takes in an array of point2d objects, and then analyzes the dataset to find points that are close together. be sure to review the point2d api. in your method, if the distance between any pair of points is less than 10, display the distance and the (x, y)s of each point. for example, "the distance between (3,5) and (8,9) is 6.40312." the complete api for the point2d adt may be viewed at ~pf/sedgewick-wayne/algs4/documenta tion/point2d. html (links to an external site.)links to an external site.. try to write your program directly from the api - do not review the adt's source code.
Answers: 1
image
Computers and Technology, 23.06.2019 18:40, brooklyn4932
How does is make you feel when you're kind to others? what are some opportunities in your life to be more kind to your friends and loved ones? imagine a world where kindness has be outlawed. how would people act differently? would your day-to-day life change significantly? why or why not?
Answers: 2
image
Computers and Technology, 24.06.2019 10:20, Cobetate
Multiple choice project create a program with two multiple choice questions. 1. users have two attempts only, show attempt number each time. hint: while loop with break control. (20%) 2. only one correct answer for each question, use switch case for each question. (20%) 3. show total score after the two questions are answered. hint: . (20%) 4. user have options to answer the two questions again if first attempt score is not 100%. hint: if statment. (20%) 5. use string method .toupper() to allow users to enter with lowercase or uppercase letters. (20%) 1. where is the capital of the state of florida? a. orlando b. tallahassee c. miami d. tampa b 2. where is walt disney world park located in florida? a. orlando b. tallahassee c. miami d. tampa a
Answers: 1
Do you know the correct answer?
Write and test a Java project that satisfies the following requirements:Create a class definition fi...

Questions in other subjects:

Konu
Biology, 24.01.2021 14:20
Konu
Physics, 24.01.2021 14:20
Konu
Engineering, 24.01.2021 14:20