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
Nataly [62]
4 years ago
13

Write the interface (.h file) of a class GasTank containing: A data member named amount of type double. A data member named capa

city of type double. A constructor that accepts a parameter of type double. A function named addGas that accepts a parameter of type double and returns no value. A function named useGas that accepts a parameter of type double and returns no value. A function named isEmpty that accepts no parameters and returns a boolean value. A function named isFull that accepts no parameters and returns a boolean value. A function named getGasLevel that accepts no parameters and returns a double. A function named fillUp that accepts no parameters and returns a double.
Computers and Technology
1 answer:
REY [17]4 years ago
7 0

Answer:

The interface(.h file) in cpp language is shown below.

#ifndef GASTANK_H

#define GASTANK_H

class GasTank

{

   //variables as mentioned

   double amount, capacity;

   //constructor

   GasTank(double p);

   //method to add gas amount

   void addGas( double g);

   //method to subtract used gas amount

   void useGas(double u);

   //method to verify if the tank is empty

   bool isEmpty();

   //method to verify if the tank is full

   bool isFull();

   //method to return current gas amount in the tank

   double getGasLevel();

   //method to return amount of gas to be filled in the tank

   double fillUp();    

};

#endif

Explanation:

1. The class GasTank ends with a semicolon.

2. The variables are declared with double datatype as mentioned.

3. The constructor is declared accepting double parameter.

4. The methods, addGas() and useGas(), accept double parameter and return no value.

5. The methods, isEmpty() and isFull() and getGasLevel() return boolean, boolean and double values, respectively.

6. The header file begins with the following keywords.

#ifndef GASTANK_H

#define GASTANK_H

7. The header file ends with the following keyword.

#endif

8. This header file is saved as GasTank.h, the name of the class with .h extension.

9. This header file is imported in the program using the following code. The header file is enclosed within quotes and not brackets like the iostream header file.

#include "GasTank.h"

10. All the code beginning with # do not end with any punctuation mark.

11. All the methods in the header file are only declared and none of the methods have any definition.

12. The program which uses this header file is responsible to define all the methods in the header file and use all the variables in the header file.

13. The cpp language does not supports interface directly. Hence, the header file is a way to implement an interface which is a feature of completely object-oriented programming languages.

14. All the requirements mentioned are implemented in the above header file.

You might be interested in
Micro sleep is when you ____.
Levart [38]

Microsleep refers to periods of sleep that last from a few to several seconds.

8 0
3 years ago
Read 2 more answers
What enables image processing, speech recognition, and complex game play in artificial intelligence?
Paraphin [41]

Deep Learning enables image processing, speech recognition, and complex game play in artificial intelligence.

<h3>What is Deep learning?</h3>

This is known to be a part of machine learning, and it is seen as  neural network that is made up of three or more layers which tries to simulate the behavior of the human brain.

Note that Deep Learning enables image processing, speech recognition, and complex game play in artificial intelligence.

See options below

1)Expert Systems

2)Deep Learning

3)Natural Language Understanding (NLU)

4)Artificial General Intelligence (AGI)

Learn more about Deep Learning from

brainly.com/question/27844272

#SPJ1

5 0
2 years ago
You are a desktop administrator for nutex corporation. Your organization uses ethernet cable to connect network resources. A use
anygoal [31]

Answer:

A. replace the network cable

Explanation:

Based on the information provided within the question it can be said that in this scenario the best option would be to replace the network cable. The network cable refers to the Ethernet cable that is connected to the individuals personal computer. This cable being faulty is most likely the reason as too why the individual is not able to connect. Since it is displaying that signals return too early it means that there is most likely information being lost in transit.

4 0
3 years ago
#Draw patterns using fibonacci
agasfer [191]

Answer:

yidRYoYORoydzyrozoyrsoyraoyeahplhDogdaoyeayeoayorahdlHDLgksOyeayeazhldhdlHkdOyaoyaerhaahdLhKDoywaeya9yaeya9eeY9ey9

7 0
3 years ago
What is cyber safety?
mario62 [17]

Answer: Cyber safety is a process that protects computers and networks. The cyber world is a dangerous place without security and protection.

Explanation: Hope this helps!

7 0
4 years ago
Other questions:
  • What is the role of the osi application layer? provides control of all the data flowing between the source and destination devic
    5·1 answer
  • 1. Caches are important to providing a high-performance memory hierarchy to processors. Below is a list of 32-bit memory address
    7·1 answer
  • Lucy wants to develop a web page to display her profile. She wants to just start with a basic page that lists her accomplishment
    13·1 answer
  • A stateless firewall inspects each incoming packet to determine whether it belongs to a currently active connection.
    9·1 answer
  • Tommy loves taking care of homing pigeons. He sent a note to his crush who lives 24.0 km away from his house. These birds fly at
    9·1 answer
  • Select the correct answer
    15·1 answer
  • Tasks you can perform online include which of the following?
    13·1 answer
  • Write a program that simulates applying a "boost" to a spaceship in a spaceship race game.
    12·1 answer
  • The math function ceil(x) returns the smallest integer that is greater than or equal to x. True False
    12·1 answer
  • What is cloud computing?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!