Write a full class definition for a class named GasTank , and containing the following members:
A data member named amount of type double.
A constructor that no parameters. The constructor initializes the data member amount to 0.
A function named addGas that accepts a parameter of type double . The value of the amount instance variable is increased by the value of the parameter.
A function named useGas that accepts a parameter of type double . The value of the amount data member is decreased by the value of the parameter. However, if the value of amount is decreased below 0 , amount is set to 0 .
A function named isEmpty that accepts no parameters and returns a boolean value. isEmpty returns a boolean value: true if the value of amount is less than 0.1 , and false otherwise.
A function named getGasLevel that accepts no parameters. getGasLevel returns the value of the amount data member.
class GasTank
{
private:
double amount;
public:
GasTank();
void addGas(double);
void useGas(double);
bool isEmpty();
double getGasLevel();
};
GasTank::GasTank(){amount = 0;}
void GasTank::addGas(double a){amount += a;}
void GasTank::useGas(double a){amount -= a; if (amount < 0) amount = 0; }
bool GasTank::isEmpty(){if(amount < .1) return true; else return false;}
double GasTank::getGasLevel() {return amount;}

Answers

Answer 1

Answer:

Explanation:

The following class code is written in Java and includes all of the required methods as requested in the question...

package sample;

class GasTank {

   private double amount = 0;

   private double capacity;

   public GasTank(double initialAmount) {

       this.capacity = initialAmount;

   }

   public void addGas(double addAmount) {

       this.amount += addAmount;

       if (amount > capacity) {

           amount = capacity;

       }

   }

   public void useGas(double subtractAmount) {

       this.amount -= subtractAmount;

       if (amount < 0) {

           amount = 0;

       }

   }

   public boolean isEmpty() {

       return (amount < 0.1);

   }

   public boolean isFull() {

       return (amount > capacity - 0.1);

   }

   public double getGasLevel() {

       return amount;

   }

   public double fillUp() {

       double difference = capacity - amount;

       amount = capacity;

       return difference;

   }

}


Related Questions

identify and explain 3 methods of automatically formatting documents​

Answers

Answer:

Three common automatic formatting for documents are...

Margin justification- where text is aligned to both the left and right margin- producing a neat page

Paragraph justification- where paragraphs are not split as they go over the page- but are moved to the next page in one piece.

Tabular justification- where text is indented or aligned at a 'tab stop'. - to emphasise a paragraph.

The 3 methods used in Microsoft word to auto format are; Margin Justification, Tabular Justification, Paragraph Justification

What is formatting in Microsoft Word?

In Microsoft word, there are different ways of formatting a text and they are;

Margin justification; This is a type of formatting where all the selected text are aligned to either the left or right margin as you go to a new page as dictated by the user.

Paragraph justification; This a type of auto formatting where paragraphs are not split as they go to a new page but simply continue from where they left off.

Tabular justification; This is a type that the text is indented or aligned at a 'tab stop' to possibly show a paragraph.

Read more about Formatting in Microsoft Word at: https://brainly.com/question/25813601

differentiate between system software and application software

Answers

Answer:

system software is the software which control overall operation of the computer . For eg. Ms.dos ,window 2003 ,etc whereas application software is a software which work on the top of operating system to solve number of problems .For eg. Ms.word,Ms.excel,etc

Difference between system software and application software :

1.) System software is used for operating computer hardware. On other hand Application software is used by user to perform specific task.

2.) Low level languages are used to write the system software. While high level languages are used to write the application software.

3.) System Software a general purpose software. While application software a specific purpose software.

4.) Without system software, system can’t run. While without application software system always runs.

5.) System software runs when system is turned on and stop when system is turned off. While application software runs as per the user’s request.

6.) System Software programming is complex than application software. Application software programming is simpler as comparison to system software.

HOPE IT HELPS

PLEASE MARK ME BRAINLIEST ☺️

You have a limited budget and you need to type color documents frequently, which type of printers would you buy?​

Answers

Answer:

you can use these printer if you have this amount of budget

Explanation:

The Merge & Center option is available in the_____________ group of the Home tab.​

Answers

Alignment group of the home tab?? I’m not too sure but I hope this helps!

What are some positive and nevative aspects of technology?

Answers

Answer:

Explanation:

Positive:

Enhances Learning.  

Fosters Problem-Solving Skills.  

Develops Future Technological Leaders

Negative:

Diminishes Relationships and Social Skills

Stimulates Health Issues

Reduces Sleep Quality

Use the drop-down menus to match each description to its corresponding term.

millions of tiny dots on a computer screen
number of pixels that span an image’s width multiplied by its height
pixels mapped onto an X-Y coordinate plane

Answers

Answer:

Your answer is

Explanation:

A monitor's screen is divided up into millions of tiny dots, called ________. Select your answer, then click Done.

You chose pixels, clicked the Done button.

Abby has a research paper to write and doesn't know which sites provide quality information. Which of the following sites is the best site for a research paper? Click the image(s) to select the answer. When you are finished, click Done.

You selected the College Online Library option, clicked the Done button.

Answer:

millions of tiny dots on a computer screen

✔ pixels

number of pixels that span an image’s width multiplied by its height

✔ image resolution

pixels mapped onto an X-Y coordinate plane

✔ raster graphic

Get it ig

Which of the following is a tip for making sure you are messaging safely?
A.Always use your full name.
B.Be careful who you allow on your buddy list.
C.Fill in your online profile in accurate detail.
D.Ignore instances of online harassment.

Answers

Answer:

B.

Explanation:

You have to be careful about the people you talk too, because, if you don't, you can be in real danger.

sorry if I am wrong

Answer: B

Explanation:

What are the types of storage?

Answers

Answer:

Primary Storage: Random Access Memory (RAM) Random Access Memory, or RAM, is the primary storage of a computer. ...

Secondary Storage: Hard Disk Drives (HDD) & Solid-State Drives (SSD) ...

Hard Disk Drives (HDD) ...

Solid-State Drives (SSD) ...

External HDDs and SSDs. ...

Flash memory devices. ...

Optical Storage Devices. ...

Floppy Disks.

Answer:

The types of storage unit are 1)magnetic storage device 2)optical storage device

Write a C program that gets 4 integer values from the user, namely, x1, x2, y1, and y2, and then calculates and returns the distance according to the above formula. Use whatever format for entering your data you like. Your program should prompt the user for these values, accept input from the keyboard, and then print out the result. You will have to execute the program four times to cover the test cases below (feel free to use a loop if you want to work ahead). Include a screenshot (or four) that shows the results for the following values: 1) (2,3), (4,5) 2) (4,3), (-6,-5) 3) (-1,3), (4,-2) 4) (-9,-12), (-7, -8)

Answers

Answer:

#include <stdio.h>

#include <math.h>

int main(){

   float x1,x2,y1,y2,distance;

   printf("x1: ");    scanf("%f", &x1);

   printf("y1: ");    scanf("%f", &y1);

   printf("x2: ");    scanf("%f", &x2);

   printf("y2: ");    scanf("%f", &y2);

   distance = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

   printf("Distance: %f", distance);

   return 0;

}

Explanation:

This line declares all required variable (i.e. the coordinates and the distance)

   float x1,x2,y1,y2,distance;

The next four line prompt and get input for the coordinates

   printf("x1: ");    scanf("%f", &x1);

   printf("y1: ");    scanf("%f", &y1);

   printf("x2: ");    scanf("%f", &x2);

   printf("y2: ");    scanf("%f", &y2);

This calculates the distance

   distance = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

This prints the calculated distance

   printf("Distance: %f", distance);

See attachment for sample runs

how are headers and footers are useful in presentation​

Answers

Answer:

Explanation:

PowerPoint is a software that allows user to create headers as well as footers which are information usually appears at the top of the slides and the information that appears at the bottom of all slides. Headers and footers are useful when making presentation in these ways:

✓ Both provide quick information about one's document/ data clearly in a predictable format. The information that is provided by the Header and footers typically consist of ;

©name of the presenters,

©the presentation title

©slide number

©date and others.

✓ They help in setting out different parts of the document.

✓Since the Headers and footers can appear on every slide, corporate confidentiality as well as copyright information can be added to footer area to discourages those that can steal ones secrete.

Which of these is a problem that a computer CANNOT solve
A. Getting the news out to the public quickly
B. Helping architects build models of new buildings
C. Getting rid of racism
D. Making a game for entertainment

Answers

The answer should be C

Getting rid of racism

Hope this helps

What is full form of (IP)​

Answers

answer:

internet protocol?

explanation:

the set of rules governing the format of data sent via the internet or local network

what is output?
a include <iostreom.h>
void sub (float & x)
{ x + =2;
cout <<" \nx="<<x;
}
اے
void main ()
{ clrser ()
float x = 5.8
cout<<" \nx="<<x'
sob (x);
Cout <<"\nx="<<x
getch ();
}​

Answers

Answer:

x=5.8

x=7.8

x=7.8

Explanation:

I repaired the code somewhat (see below).

Since x is passed as a reference variable to the sub function, inside sub() the original variable is modified, so the changed value affects the variable declared in main().

If you would remove the & in sub, this wouldn't happen, and the variable in main would keep its value 5.8.

Please Help I'm Very Stressed, my school is holding a competition of making the best video game and the winner gets 1000$ and I really want 1000$, the problem is that I can't make any good games or don't have any ideas for anything the game has to have lore and a plot and characters and it's really stressing so please help me get a idea or something easy enough to make

Answers

Answer:

make a game like fun run

Explanation:

Answer:

u should make an competive game where people battle each other sorry if i cant spell good its cause im rushing

Explanation:

Harry wants to change the background of all of his presentation slides. Which slide will enable him to make this change to all the slides at once?
Harry needs to change the ___________ to change the background of all his presentation slides.

Answers

Answer:

settings

Explanation:

edmentum

Identify the suitable synonym for the given words
ignorant

Answers

Answer: uneducated

Explanation:

uneducated

uneducated, mindless

how does dual concepts work?​

Answers

The transaction that affects a business

What is the second step in opening the case of working computer

Answers

Answer: 1. The steps of opening the case of a working computer as follows:

2. power off the device.

3. unplug its power cable.

4. detach all the external attachments and cables from the case.

5. Remove the retaining screws of the side panel.

6. Remove the case's side panel.

Explanation:

My goal is to help Edmentum kids
Select the correct answer.
What type of communication flow occurs in a formal network when employees submit status reports to their superiors?
A.
downward communication
B.
horizontal communication
C.
lateral communication
D.
upward communication
Hopefully people will answer these

Answers

Answer:

D upward communication

Answer:

D.

upward communication

Explanation:

The place where an organism lives and that provides the things the organism needs is called it’s

Answers

Answer:

A habitat is a place where an organism makes its home. A habitat meets all the environmental conditions an organism needs to survive.

Explanation:

why is GDS important to travel industry?

Answers

Answer:

A Global Distribution System (GDS) is a wonderful tool that properties should use to reach customers easily. This is a central reservation system that allows travel agents to access hotel rates and availability as well as prices for flights, trains and rental car companies in real time.

What kinds of animations are available for slide objects besides animations for entrances and exists?

Answers

Entrance. Entrance animations are used to introduce a slide object within a slide or Emphasis. Emphasis animations are used to animate slide objects that are already present on a slide.

How can you determine if the story is told in the third person

Answers

Answer:

They use pronouns like They, Them, He, She, It.

advantage of using computer​

Answers

Answer:

What are the advantages of using a computer?

Although there are disadvantages to using a computer, we believe the advantages greatly outweigh the disadvantages (although we may be biased). Below is a list of the main advantages and benefits you'll get and society gets from using a computer.

Increase your productivityComputers increase your productivity and, with a good understanding of the software running on them, you become more productive at everything you do. For example, once you have a basic understanding of using a word processor, you can create, store, edit, share, and print documents and letters. Each of these things was either impossible or slower with all pre-existing technologies.

Connects you to the InternetConnecting a computer to the Internet is what unlocks the full potential of a computer. Once connected, your choices and available options are almost limitless. Many of the benefits listed on this page are with a computer connected to the Internet.

Can make you money?When connected to the Internet, a computer could help you make money many different ways. For example, it's cheaper to create and run an online store than having a physical store. Also, once online, your store or product has a global audience and you could sell to anyone in the world.Save timeToday, there are many services that help save you time. Several examples are listed below.

Using a site like Amazon, you can find many of the same products you would find at a store for the same price or cheaper. You can also have those items shipped to your door without having to leave your home.

You could use an online banking site to view your bank balance and pay bills.

If your favorite restaurant has a website, you can order take out without having to wait in line.

You can view online traffic cameras and maps with traffic information to find the quickest route.

C++ "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simonPattern and userPattern are always the same length.
Ex: The following patterns yield a userScore of 4:
Ex: The following patterns yield a userScore of 9:
simonPattern: RRGBRYYBGY
userPattern: RRGBBRYBGY
Result: Can't get test 2 to occur when userScore is 9
Testing: RRGBRYYBGY/RRGBBRYBGY
Your value: 4
Testing: RRRRRRRRRR/RRRRRRRRRY
Expected value: 9
Your value: 4
Tests aborted.

Answers

Answer:

In C++:

#include <iostream>

using namespace std;

int main(){

   int userScore = 0;

   string simonPattern, userPattern;

   cout<<"Simon Pattern: ";    cin>>simonPattern;

   cout<<"User Pattern: ";    cin>>userPattern;

   for (int i =0; i < simonPattern.length();i++){

       if(simonPattern[i]== userPattern[i]){

           userScore++;        }

       else{            break;        }

   }

   cout<<"Your value: "<<userScore;

   return 0;

}

Explanation:

This initializes user score to 0

   int userScore = 0;

This declares simonPattern and userPattern as string

   string simonPattern, userPattern;

This gets input for simonPattern

   cout<<"Simon Pattern: ";    cin>>simonPattern;

This gets input for userPattern

   cout<<"User Pattern: ";    cin>>userPattern;

This iterates through each string

   for (int i =0; i < simonPattern.length();i++){

This checks for matching characters

       if(simonPattern[i]== userPattern[i]){

           userScore++;        }

This breaks the loop, if the characters mismatch

       else{            break;        }

   }

This prints the number of consecutive matches

   cout<<"Your value: "<<userScore;

Assume three jobs arrive at approximately the same time (arrival time are all 0), but Job A arrives slightly before Job B, and Job B arrives slightly before job C (if the jobs must be selected in order, the order should be A->B->C). Job A requires 2 sec of CPU, Job B is 8 secs, and Job C is 7 secs. Assume a time-slice of 1 second. Given a RR scheduler (time slice is 1sec), what is the average response time of the three jobs?

Answers

Answer:

Explanation:

Correct:


Write a program in QBasic to enter two numbers and print the greater one.​

Answers

Answer:

REM

CLS

INPUT “ENTER ANY TWO NUMBERS”; A, B

IF A > B THEN

PRINT A; “IS GREATER”

ELSE

PRINT B; “IS GREATER”

END IF

END

class one

{

public static void main ( )

{

int a = 1,b = 2;

if ( a > b )

{

System.out.print (" greater number is " + a);

}

else if ( a < b )

{

System.out.print (" greater number is " + b);

}

}

}

Which statement in main() generates an error?
public class Players {
public void setName(String newName) { … }
public void setAge(int newAge) { … }
};
public class SoccerPlayers extends Players {
public void setDetails(String newName) { … }
public String getLeague() { … }
};
public static void main(String args[]) {
String leagueName;
Players newPlayers = new Players();
SoccerPlayers playerObject = new SoccerPlayers();
playerObject.setName("Jessica Smith");
playerObject.setAge(21);
leagueName = newPlayers.getLeague(); }
A. SoccerPlayers playerObject=new SoccerPlayers(); An object of a derived class cannot be created.
B. playerObject.setName("Jessica Smith"); setName() is not declared in SoccerPlayers.
C. leagueName=newPlayers.getLeague(); getLeague() is not a member of Players.
D. Players newPlayers=new Players(); An object of a base class cannot be created.

Answers

Answer:

C. leagueName=newPlayers.getLeague(); getLeague() is not a member of Players.

Explanation:

The main method in this code will case an error when trying to run the following line of code...

leagueName=newPlayers.getLeague();

This is because the method getLeague() is being called on a Player object which takes all of its methods from the Player class. Since getLeague() is not a method located in the player class then it cannot be called by an object from that class. Especially since the Player class does not extend to the SoccerPlayers class where the getLeague() method is actually located. Instead, it is the SoccerPlayers class which extends the Players class as its parent class.

Sentence Deobfuscate Name this file deobfuscate.cpp Hints: Don’t overthink this problem. Prompt the user to enter a collection of sentence words (i.e., words in the sentence), with the spaces removed (i.e., the obfuscated sentence) and with words that are less than ten (10) letters each. Then prompt the user to enter a sequence of numbers that represent the length of each corresponding sentence word (i.e. the deobfuscated details). Output the deobfuscated sentence. Convert char c to int by subtracting 48 (‘0’) from c.
Sample Execution:
Please enter obfuscated sentence: Thisisasentence
Please enter deobfuscation details: 4218
Deobfuscated sentence: This is a sentence

Answers

Answer:

In C++:

#include <iostream>

using namespace std;

int main(){

   string text,lengt;

   cout<<"Please enter obfuscated sentence: ";    cin>>text;

   cout<<"Please enter deobfuscation details: ";    cin>>lengt;

   string t1, t2;

   int kount = 0;

   for(int i = 0;i<lengt.length();i++){

   kount+=(int)(lengt[i]-'0');

   t1 = text.substr(0, kount);

   t2 = text.substr(kount, text.length()-1);

   text = t1 +" "+ t2;

   kount++;   }

   cout<<"Deobfuscated sentence: "<<text;

   return 0; }

Explanation:

This declares the text and the deobfuscation details as string

   string text,lengt;

This prompts for the sentence

   cout<<"Please enter obfuscated sentence: ";     cin>>text;

This prompts for the details

   cout<<"Please enter deobfuscation details: ";     cin>>lengt;

t1 and t2 are declared as string. They are used to split the texts into 2 parts

   string t1, t2;

This declares and initializes a count variable to 0  

   int kount = 0;

This iterates through the deobfuscation details

for(int i = 0;i<lengt.length();i++){

This gets each deobfuscation character

   kount+=(int)(lengt[i]-'0');

The next two instructions splits the text into 2

This gets from 0 to kount.

   t1 = text.substr(0, kount);

This gets from kount to the last index

   t2 = text.substr(kount, text.length()-1);

The new string or sentence is calculated here

   text = t1 +" "+ t2;

The kount variable is incremented by 1

   kount++;   } The loop ends here

This prints the new sentence

   cout<<"Deobfuscated sentence: "<<text;

See attachment for program file

Explain, step by step the process required to carry out drive error correction (disk check) on Windows 10​

Answers

Explanation:

Disk Error Checking in Windows 10

In Windows 8, Microsoft has redesigned chkdsk utility – the tool for detecting and fixing disk corruption. In Windows 8, Microsoft introduced a file system called ReFS, which does not require an offline chkdsk to repair corruptions – as it follows a different model for resiliency and hence does not need to run the traditional chkdsk utility.

The disk is periodically checked for file system errors, bad sectors, lost clusters, etc., during Automatic Maintenance and you now no longer need to really go and run it. In fact, Windows 8 now even exposes the state of the file-system and disk via the Action Center or under the Drive properties in File Explorer. If potential errors are found, you will be informed about it. You can continue to use the computer, while the scan is carried out in the background. If errors are found, you may be prompted via a notification to restart your computer.

Read: How to cancel ChkDsk in Windows.

Windows found errors on this drive that need to be repaired

At times you may see a message – Windows found errors on this drive that need to be repaired. If you see it, you may want to manually run a scan. Earlier you had to schedule Disk Error Checking for the system drive and for drives which had files or processes or folders opened. In Windows 10/8, error checking starts right away, even on the system drive – and it longer needs to be scheduled at start-up. Only if some errors are found, will you have to restart to let Windows 10/8 fix the errors.

How to run CHKDSK in Windows 10

To begin the scan, right-click on the Drive which you wish to check and select Properties. Next, click on Tools tab and under Error-checking, click on the Check button.  This option will check the drive for file system errors.

If the system detects that there are errors, you will be asked to check the disk. If no errors are found, you will see a message – You don’t need to scan this drive. You can, nevertheless, choose to check the drive. Click on Scan drive to do so.

Other Questions
Derek has a bank account that pays 4.1% simple interest. He deposits $910 and leaves it in for 2.5 years. How much interest does he earn. For what equations below is x = -3 a possible equation select three options Jerry solved the equation 2x-4=20 by adding four 1-tiles to each side. Explain why Jerry's method works. 5 members or 20% of the math league did not come to the meet. how many total members are there I got commitment issues but I'm tryna fix that for youIf I can't afford that bag that you want then I would lick that for youI wanna be there for you, I knew that the day I saw youToo many times we argue, sorry for all of the names I called youShoulda never called you a b but I didNow you're p, tryna cut my clothes (don't do that)Should have deleted that textThen you wouldn't of known that I f those h (alright)Don't act like you care how I feel, don't act like you care how I feel, you don'tDon't like how you act so spoilt, you start move mad when I tell you "No" PLEASE ANSWER!! THANK YA! Using Graham's Law of Effusion, calculatethe approximate time it would take for1.0 L of argon gas to effuse, if 1.0 L ofoxygen gas took 12.7 minutes to effusethrough the same opening. help plsss Write an equation for the word problem and solve it (show work)."ally became a waiter at a fancy restaurant. She makes $9 per hour. One night she made $150 in tips. How many hours did she work if he made a total of $226.50."Variable: x = hoursEquation: __________________Work:Solution: x = ______ hours What happens when we know about other living beings ?Please I need it soon y=6x-14 & y=-2x+34 solved in the substitution method how do you classify a triangle by its side measurements What is the area of the triangle?623 Helps me solve this problem please In the last years of the 20th century, immigrants into the United States were MOST likely to come fromA)Russia.B)Canada,VietnamD)Latin America. if What anthony davis did to be successful in his carrer? enumere seis pasos que siguen el proceso de la produccin de la panela de la caa de azcar John is testing his friend. He wrote the following on an index card:My grandfather is 68, adopted my mother on Sunday, March 18, 2001. My mother was not even a year old. My mother had me at 18. How old am I? Under each photo,write an example of where youmight find water in that state ofmatter. What is the value of the following expression if x = 4, 2x + 3.1 Where do ukuleles originate?