subject

Write a Patron. java program using Jrasp and Dr. java to test it. The Patron constructor will be used to initialize all attributes of the Patron object. The adjustBalance will update the current balance of the patron. For example if the current balance of a Patron is 2.0 and the amount is 4.5, this method should assign 6.50 to this. balance and return 6.50.The equals method checks whether two patrons have the same id number. If the given object is a Patron, compare this. idNumber with the other patron's idNumber. If the given object is an Integer, compare this. idNumber with the Integer. The toString method should return a String representation of the Patron. If a patron is initialized with the following parameters ("bob", "eee", 2, 5.5), it should return a String exactly as follows: "Name: bob, Email: eee, ID: 2, Balance: $5.50."Code for PatronTest Caseimport junit. framework. TestCase;/*** Tests Patron: currently one test method.** @author* @version**/public class PatronTest extends TestCase { /** A single test for Patron. **/ public void testPatron() { Patron aPatron1 = new Patron("Dee A. B. Weikle", "[email protected]", 2, 1.50); assertEquals("Patron: toString", "Name: Dee A. B. Weikle," + " Email: [email protected], ID: 2, Balance: $1.50.", aPatron1.toString()); Patron aPatron2 = new Patron("Dee A. B. Weikle", "[email protected]", 2, 1.50); assertTrue("Patron: equals", aPatron1.equals(aPatron2)); aPatron1.adjustBalance(2.50); assertEquals("Patron: toString", "Name: Dee A. B. Weikle," + " Email: [email protected], ID: 2, Balance: $4.00.", aPatron1.toString()); }}

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:10, victoriadorvilu
This program reads a file called 'test. txt'. you are required to write two functions that build a wordlist out of all of the words found in the file and print all of the unique words found in the file. remove punctuations using 'string. punctuation' and 'strip()' before adding words to the wordlist. write a function build_wordlist() that takes a 'file pointer' as an argument and reads the contents, builds the wordlist after removing punctuations, and then returns the wordlist. another function find_unique() will take this wordlist as a parameter and return another wordlist comprising of all unique words found in the wordlist. example: contents of 'test. txt': test file another line in the test file output: ['another', 'file', 'in', 'line', 'test', 'the']
Answers: 1
image
Computers and Technology, 22.06.2019 22:50, youngboymark123
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
image
Computers and Technology, 23.06.2019 02:30, jaueuxsn
Which component acts as a platform on which application software runs
Answers: 2
image
Computers and Technology, 23.06.2019 05:00, sharkboy578
Acompany is inviting design for its new corporate logo from its users. this is an example of ? a. crowdfunding b. crowdvoting c. crowdsourced design d. crowdtracking
Answers: 3
You know the right answer?
Write a Patron. java program using Jrasp and Dr. java to test it. The Patron constructor will be use...

Questions in other subjects:

Konu
Mathematics, 15.02.2021 18:30
Konu
Advanced Placement (AP), 15.02.2021 18:30
Konu
Biology, 15.02.2021 18:30