1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
crimeas [40]
2 years ago
5

Implement a class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon or liters/kmâ

pick one) and a certain amount of fuel in the gas tank. The efficiency is specified in the constructor, and the initial fuel level is 0. Supply a function drive that simulates driving the car for a certain distance, reducing the fuel level in the gas tank, and functions get_gas, to return the current fuel level, and add_gas, to tank up. Sample usage:Car my_beemer(29); // 29 miles per gallonmy_beemer.add_gas(20); // Tank 20 gallonsmy_beemer.drive(100); // Drive 100 milescout << my_beemer.get_gas() << "\n"; // Print fuel remaining
Computers and Technology
1 answer:
zvonat [6]2 years ago
3 0

Answer:

class Car(object):

   fuel = 0

   def __init__(self, mpg):

       self.mpg = mpg

   def drive(self, mile):

       if self.fuel * self.mpg >= mile:

           self.fuel -= mile / self.mpg

       else:

           print(f"get gas for your {self}")

       print(f"Fuel remaining: {self.fuel}")

   #classmethod

   def get_gas(cls):

       cls.fuel += 50

   #classmethod

   def add_gas(cls, gallon):

       if cls.fuel + gallon > 50:

           cls.fuel += 10

       else:

           cls.fuel += gallon

gulf = Car(20)

gulf.get_gas()

gulf.drive(200)

Explanation:

The Car class is defined in Python. Its drive method simulates the driving of a car with fuel that reduces by the miles covered, with efficiency in miles per gallon. The get_gas and add_gas methods fill and top up the car tank respectively.

You might be interested in
Clickstream tracking tools collect data on customer activities at web sites (true/false)?
Galina-37 [17]

Clickstream tracking tools collect data on customer activities at websites- true.

<h3>what is the website?</h3>
  • A website, often known as a website, is a collection of web pages and associated material that is published on at least one web server and given a shared domain name.
  • The World Wide Web is the aggregate name for all publicly accessible websites.
  • A company's internal website for its workers is an example of a private website that can only be viewed via a private network.
  • Most websites focus on a single subject or objective, including news, education, business, entertainment, or social networking.
  • The navigation of the website, which frequently begins with a home page, is aided by hyperlinks between web pages.

To learn more about website, refer to the following link:

brainly.com/question/9060926

#SPJ4

3 0
1 year ago
What are the programs in a computer​
stealth61 [152]

Answer:

Computer skills examples

Operating systems  

Office suites  

Presentation software

Spreadsheets  

Accounting software

Explanation:

A program is a set of ordered operations for a computer to do in computing. The program in the modern computer described by John von Neumann in 1945 has a one-at-a-time series of instructions that the computer follows. Typically, the application is saved in a computer-accessible storage location.

4 0
2 years ago
A Chief Security Officer (CSO) has asked a technician to devise a solution that can detect unauthorized execution privileges fro
VikaD [51]

A solution which would best meet the CSO's requirements is: B. Sandboxing.

<h3>What is a sandbox?</h3>

A sandbox can be defined as an isolated environment in a computer system or on a network that is designed and developed to mimic end user operating system (OS) and environments, so as to detect unauthorized execution privileges from the operating system (OS).

In cybersecurity, sandboxing is typically used to safely execute suspicious code and data files without causing any harm to the host device or network. Also, sandboxing can work in conjunction with proxies or unified threat management (UTM).

Read more on sandboxing here: brainly.com/question/25883753

8 0
2 years ago
Identify a syntax used to create a spinner control using an input element. a. b. c. d.
Lorico [155]

Answer:

Option A:

<input name="name" id="id" type="number" value="value" step="value" min="value" max="value" />

Explanation:

Spinner control is a graphical control element where user can adjust the value by pressing up or down arrow button. An example is given in the attached image.

In HTML, one of the key attributes we must use to create a spinner control is "step". The attribute "step" is required to specify the interval of the step value when user press the up or down arrow button.

If we set the attribute values as follows:

  • type = "number"
  • value = 2
  • min = 0
  • max = 10

The setting above will give a spinner control with a range of legal numbers between 0, 2, 4, 6, 8 and 10.

6 0
3 years ago
The _____ is a storage location for text awaiting pasting.
Tanzania [10]
What's your answers? 
8 0
3 years ago
Read 2 more answers
Other questions:
  • Who is good with Introduction to photography? I don’t know nothing about cameras if you do please contact me ASAP
    13·1 answer
  • Design a method for representing the state of a tic-tac-toe board in computer memory. can you fit your representation into three
    12·2 answers
  • 22 If you are involved in a violation and you do not have insurance to comply with the __________________, your driver license a
    9·2 answers
  • Pls Help Me!!!!!!!!!!! It won’t work when I connect to ITunes!
    12·1 answer
  • Emerson needs to tell his browser how to display a web page. Which tool will he use?
    8·2 answers
  • PLEASE HELP ASAP!!
    11·2 answers
  • Uuhdcnkhbbbbhbnbbbbnnnnnnnnnfddjkjfs
    14·1 answer
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    9·1 answer
  • Abby has received a request for a data set of actual data for testing a new app that is being developed. She does not want the s
    13·1 answer
  • Briefly define each components of information systems (hardware, software, data, networking, people and procedure). While you ar
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!