1 / 1

Add the following methods to BpeppsClass :

Add the following methods to BpeppsClass :. An overloaded constructor – it should receive no parameters, and assign the number 42 to the age variable. An overloaded abs( ) – receives two numbers as parameters, only returns the absolute value of the smaller number.

jamuna
Download Presentation

Add the following methods to BpeppsClass :

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Add the following methods to BpeppsClass: • An overloaded constructor – it should receive no parameters, and assign the number 42 to the age variable. • An overloaded abs( ) – receives two numbers as parameters, only returns the absolute value of the smaller number. • same( ) – receives 2 words as parameters, returns true if they are the same word • An overloaded same( ) – receives one word as a parameter, returns true if the word is “bird” • convertToDecimal( ) – receives a String parameter (which will actually be an 8-bit binary #), converts this number to decimal, and returns it (as an int). • displayGreeting( ) – a private method that just displays “oh hey.” • letterGame( ) – receives no parameters, calls the private method displayGreeting( ), creates a random lowercase letter (hint: easier than it seems), then gives the user 10 chances to guess the letter. Returns nothing.

More Related