1 create the object
Download
Skip this Video
Download Presentation
1: create the object

Loading in 2 Seconds...

play fullscreen
1 / 7

1: create the object - PowerPoint PPT Presentation


  • 264 Views
  • Uploaded on

1: create the object Car String regNo int mileage int fuel String getRegNo() void setRegNo(num) int getMileage() void setMileage(miles) int getFuel() void setFuel(litres) void makeJourney(miles,litres) void refuel(litres) Car() constructor Constructor method: Car()

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about '1: create the object' - Gabriel


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
1 create the object
1: create the object

Car

String regNo

int mileage

int fuel

String getRegNo()

void setRegNo(num)

int getMileage()

void setMileage(miles)

int getFuel()

void setFuel(litres)

void makeJourney(miles,litres)

void refuel(litres)

Car() constructor

Constructor method:Car()

Instruction:Car myCar = new Car()

show it

exit

2 set registration number
myCar : Car

String regNo = ?

int mileage = ?

int fuel = ?

String getRegNo()

void setRegNo(num)

int getMileage()

void setMileage(miles)

int getFuel()

void setFuel(litres)

void makeJourney(miles,litres)

void refuel(litres)

2: set registration number

Message:setRegNo( “RWK 432X” )

Sent to object:myCar

show it

exit

3 set mileage
3: set mileage

myCar : Car

String regNo = “RWK 432X”

int mileage = ?

int fuel = ?

String getRegNo()

void setRegNo(num)

int getMileage()

void setMileage(miles)

int getFuel()

void setFuel(litres)

void makeJourney(miles,litres)

void refuel(litres)

Message:setMileage( 34219 )

Sent to object:myCar

show it

exit

4 get mileage
4: get mileage

myCar : Car

String regNo = “RWK 432X”

int mileage = 34219

int fuel = ?

String getRegNo()

void setRegNo(num)

int getMileage()

void setMileage(miles)

int getFuel()

void setFuel(litres)

void makeJourney(miles,litres)

void refuel(litres)

Message:getMileage( )

Sent to object:myCar

show it

exit

5 set fuel
5: set fuel

myCar : Car

String regNo = “RWK 432X”

int mileage = 34219

int fuel = ?

String getRegNo()

void setRegNo(num)

int getMileage()

void setMileage(miles)

int getFuel()

void setFuel(litres)

void makeJourney(miles,litres)

void refuel(litres)

Message:setFuel( 20 )

Sent to object:myCar

show it

exit

6 make a journey
6: make a journey

myCar : Car

String regNo = “RWK 432X”

int mileage = 34219

int fuel = 20

String getRegNo()

void setRegNo(num)

int getMileage()

void setMileage(miles)

int getFuel()

void setFuel(litres)

void makeJourney(miles,litres)

void refuel(litres)

Message:makeJourney( 50,8 )

Sent to object:myCar

show it

exit

7 the end the final state of the object
7: The end:- the final state of the object

myCar : Car

String regNo = “RWK 432X”

int mileage = 32469

int fuel = 12

String getRegNo()

void setRegNo(num)

int getMileage()

void setMileage(miles)

int getFuel()

void setFuel(litres)

void makeJourney(miles,litres)

void refuel(litres)

show it

exit

ad