SlideShare une entreprise Scribd logo
1  sur  1
Télécharger pour lire hors ligne
4. Implement a class, Car, which represents a car and can simulate its fuel usage. The fuel
efficiency should be specified when the object is created. The class should contain the following.
Constructor - init_(self, efficiency) Instance Variables - fuelEfficiency fuel efficiency (measured
in km/ litres); float - fuel amount of gas in tank (litres) with an initial value of zero; float
Methods - drive (distance) -simulates driving the car for certain distance, reducing the fuel level
in the gas tank based on the fuel efficiency - getGaslevel() - returns the current fuel level -
addGas (amount) adds amount to instance variable fuel

Contenu connexe

Plus de amberteleshoppe

4. If there were n arrivals of a Poisson process with Sn being th.pdf
 4. If there were  n  arrivals of a Poisson process with Sn being th.pdf 4. If there were  n  arrivals of a Poisson process with Sn being th.pdf
4. If there were n arrivals of a Poisson process with Sn being th.pdf
amberteleshoppe
 

Plus de amberteleshoppe (20)

4. Inflation and interest rates The following table shows the avenge .pdf
 4. Inflation and interest rates The following table shows the avenge .pdf 4. Inflation and interest rates The following table shows the avenge .pdf
4. Inflation and interest rates The following table shows the avenge .pdf
 
4. In the sub-basement of the 600 3. Michigan Ave, building, a bone f.pdf
 4. In the sub-basement of the 600 3. Michigan Ave, building, a bone f.pdf 4. In the sub-basement of the 600 3. Michigan Ave, building, a bone f.pdf
4. In the sub-basement of the 600 3. Michigan Ave, building, a bone f.pdf
 
4. Imagine that you crossed (mated) two true-breeding (homozygous) pa.pdf
 4. Imagine that you crossed (mated) two true-breeding (homozygous) pa.pdf 4. Imagine that you crossed (mated) two true-breeding (homozygous) pa.pdf
4. Imagine that you crossed (mated) two true-breeding (homozygous) pa.pdf
 
4. If there were n arrivals of a Poisson process with Sn being th.pdf
 4. If there were  n  arrivals of a Poisson process with Sn being th.pdf 4. If there were  n  arrivals of a Poisson process with Sn being th.pdf
4. If there were n arrivals of a Poisson process with Sn being th.pdf
 
4. How do you go back to the standardcanonical form for a LP when a.pdf
 4. How do you go back to the standardcanonical form for a LP when a.pdf 4. How do you go back to the standardcanonical form for a LP when a.pdf
4. How do you go back to the standardcanonical form for a LP when a.pdf
 
4. Identify the tissue. 1pt. 5. Identify the tissue. Name two of its .pdf
 4. Identify the tissue. 1pt. 5. Identify the tissue. Name two of its .pdf 4. Identify the tissue. 1pt. 5. Identify the tissue. Name two of its .pdf
4. Identify the tissue. 1pt. 5. Identify the tissue. Name two of its .pdf
 
4. If we wanted to store Bill Gates net worth accurately to the penn.pdf
 4. If we wanted to store Bill Gates net worth accurately to the penn.pdf 4. If we wanted to store Bill Gates net worth accurately to the penn.pdf
4. If we wanted to store Bill Gates net worth accurately to the penn.pdf
 
4. Henry, age 35, is a stay at home dad. His wife, Melissa, age 34 , .pdf
 4. Henry, age 35, is a stay at home dad. His wife, Melissa, age 34 , .pdf 4. Henry, age 35, is a stay at home dad. His wife, Melissa, age 34 , .pdf
4. Henry, age 35, is a stay at home dad. His wife, Melissa, age 34 , .pdf
 
4. Given a random variable XN(,2) and a fixed quantity 01, define t.pdf
 4. Given a random variable XN(,2) and a fixed quantity 01, define t.pdf 4. Given a random variable XN(,2) and a fixed quantity 01, define t.pdf
4. Given a random variable XN(,2) and a fixed quantity 01, define t.pdf
 
4. Find the dimension and a basis representation of the subspace H=sp.pdf
 4. Find the dimension and a basis representation of the subspace H=sp.pdf 4. Find the dimension and a basis representation of the subspace H=sp.pdf
4. Find the dimension and a basis representation of the subspace H=sp.pdf
 
4. Explain how salt regulation is related to water regulation. How do.pdf
 4. Explain how salt regulation is related to water regulation. How do.pdf 4. Explain how salt regulation is related to water regulation. How do.pdf
4. Explain how salt regulation is related to water regulation. How do.pdf
 
4. Fill in the blanks with one of the following terms Deletion; Inve.pdf
 4. Fill in the blanks with one of the following terms Deletion; Inve.pdf 4. Fill in the blanks with one of the following terms Deletion; Inve.pdf
4. Fill in the blanks with one of the following terms Deletion; Inve.pdf
 
4. Details about shareholders equity and dilutive securities CHAP.pdf
 4. Details about shareholders equity and dilutive securities CHAP.pdf 4. Details about shareholders equity and dilutive securities CHAP.pdf
4. Details about shareholders equity and dilutive securities CHAP.pdf
 
4. Consider two unitary transformations II and UCNOT. What is the hig.pdf
 4. Consider two unitary transformations II and UCNOT. What is the hig.pdf 4. Consider two unitary transformations II and UCNOT. What is the hig.pdf
4. Consider two unitary transformations II and UCNOT. What is the hig.pdf
 
4. Bechtel Corp.s common shares are trading for $45.83 per share. Th.pdf
 4. Bechtel Corp.s common shares are trading for $45.83 per share. Th.pdf 4. Bechtel Corp.s common shares are trading for $45.83 per share. Th.pdf
4. Bechtel Corp.s common shares are trading for $45.83 per share. Th.pdf
 
4. Consider a finite set X and a rational preference relation on X. .pdf
 4. Consider a finite set X and a rational preference relation  on X. .pdf 4. Consider a finite set X and a rational preference relation  on X. .pdf
4. Consider a finite set X and a rational preference relation on X. .pdf
 
4. Consider two qubit states 0 and =(01)2 generated with probability.pdf
 4. Consider two qubit states 0 and =(01)2 generated with probability.pdf 4. Consider two qubit states 0 and =(01)2 generated with probability.pdf
4. Consider two qubit states 0 and =(01)2 generated with probability.pdf
 
4. Calculating the marginal rate of substitution (MRS) Raphael likes .pdf
 4. Calculating the marginal rate of substitution (MRS) Raphael likes .pdf 4. Calculating the marginal rate of substitution (MRS) Raphael likes .pdf
4. Calculating the marginal rate of substitution (MRS) Raphael likes .pdf
 
4. Case study. - As part of a formal risk assessment of the main file.pdf
 4. Case study. - As part of a formal risk assessment of the main file.pdf 4. Case study. - As part of a formal risk assessment of the main file.pdf
4. Case study. - As part of a formal risk assessment of the main file.pdf
 
4. Answer the questions below about the following tree, using the let.pdf
 4. Answer the questions below about the following tree, using the let.pdf 4. Answer the questions below about the following tree, using the let.pdf
4. Answer the questions below about the following tree, using the let.pdf
 

Dernier

Dernier (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 

4. Implement a class, Car, which represents a car and can simulate it.pdf

  • 1. 4. Implement a class, Car, which represents a car and can simulate its fuel usage. The fuel efficiency should be specified when the object is created. The class should contain the following. Constructor - init_(self, efficiency) Instance Variables - fuelEfficiency fuel efficiency (measured in km/ litres); float - fuel amount of gas in tank (litres) with an initial value of zero; float Methods - drive (distance) -simulates driving the car for certain distance, reducing the fuel level in the gas tank based on the fuel efficiency - getGaslevel() - returns the current fuel level - addGas (amount) adds amount to instance variable fuel