Question: Please help me solve this java question. Thanks Implement the class Vaccine so that it contains: J J K 3 private instance variables: name of

Please help me solve this java question. Thanks

Please help me solve this java question. ThanksPlease help me solve this java question. Thanks
Implement the class Vaccine so that it contains: J J K 3 private instance variables: name of type String, doses of type integer which records the number of doses taken, and isAuthor'ized which is Boolean and indicates if the vaccine is proven safe or not. A default constructor which sets the numeric instance variable to zero and the String instance variable to null. A constructor with 3 parameters which sets the 3 instance variables to the corresponding values passed. Implement an accessor method for each of the 3 instance variables that will return the value of the instance variable. For example, the getX() method for the instance variable name must be called getName( ). Implement a mutator method for each instance variable that will assign to the instance variable the value passed. Forr example, the setXO method for the instance variable type must be called setName( ). An equaLs method: two objects of type Vaccine are equal if all the attributes of both objects have the same values. A Boolean method bothAuthor'ized which returns true if both vaccines are Authorized and faLse othenrvise. A toString function must also be provided to return the vaccine information in the following format: The Vaccine of name has dose(s) and is Authorized is Where , and are the contents of the instance variables. If you correctly implemented all the above, running the main method will result in your program displaying exactly as in the boxes below. Your program should work for any values entered. REMEMBER in the output: . is a space, > is a tab and .J is a new line. Text in green is user input. The only formatting you are concerned with is the one generated by the toString method (in blue) the rest is already set in the main method which you are not to change. What is the nameof this Vaccine? Polio How many needed dosesof .this .Vaccine? .4 Isit an Authorized Vaccine? (true.or false) true The two Vaccines are: TheVaccine of name.null has.@ dose(s) andis .Authorized is false TheVaccine of name Polio has .4.dose(s ) andis .Authorized is.true Let's set up the 1stoVaccine. .. What is the name? Polio How many doses ? 4 Isit an.Authorized Vaccine (true.orfalse) ?ofalse Vaccine1: The Vaccine of name Polio has .4. dose (s) and is .Authorized isofalse Arethe 2.Vaccine objects equal?No Are they both Authorized.Vaccine? false Now are they both Authorized.Vaccine? true Whatis the name of.this .Vaccine? Cholera How many needed.dosesof this .Vaccine?1 Is it an Authorized Vaccine?(true.or false) false The two Vaccines are: TheVaccine ofoname.null has.@.dose(s) andis Authorizedisofalse TheVaccine of name .Cholerahas 1.dose (s ) and is .Authorized is .false Let's set up the 1stoVaccine. . . What is the name ? Polio How many doses ? 4 Is it an Authorized.Vaccine (true.orofalse) ? false Vaccine1: The.Vaccine of.name.Polio has .4.dose(s ) and is .Authorized is false Are the.2.Vaccine objects.equal? No Are they both Authorized Vaccine? false Now are they both Authorized.Vaccine? false Note 1: You are to expect a perfect user who will always enter valid values; that is, do not verify the validity of user input. Note 2: The use of libraries other than java.util.Scanner is prohibited. Your program must work for data entered, not just the ones in the samples above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!