Answer:
See attachment 1 for code
See attachment 2 for the output of permuting letters of parba
See attachment 3 for the output of permuting letters of arbca
Explanation:
The program was implemented in C
The program uses a recursive function letterpermutation and a swap function to successfully implement the requirement of this question.
The letterpermutation function is defined here
void letterpermutation(char *mystring, int index1, int index2) {
This lets the program writes to a file
FILE *fptr;
This opens the file in an appending mode
fptr = fopen("q3out.txt","a");
int i;
This checks for unique strings.
if (index1 == index2) {
If found, this appends the string to the text file
fprintf(fptr,"%s\n",mystring); }
If otherwise
else{
This iterates through the string
for (i = index1; i <= index2; i++) {
The swap function is called to swap the characters of the string
swap((mystring+index1), (mystring+i));
This calls the function, recursively
letterpermutation(mystring, index1+1, index2);
This further swaps the characters of the string
swap((mystring+index1), (mystring+i));
} } }
The swap function begins here and what it literally does is that it swaps characters of the input string to create a new string
void swap(char *ch1, char *ch2) {
char temp;
temp = *ch1; *ch1 = *ch2; *ch2 = temp; }
The main function begins here
int main() {
This declares and initializes the string
char mystring[] = "ABCd"; // The string here can be changed
This calls the function to permute the string
letterpermutation(mystring, 0, strlen(mystring)-1);
return 0; }
my uh coding teacher would like the class to do little piggy with code.
Write code using def to create functions so that each line is printed in its own function. Turn in a gdb link so I can grade it.
This little pig went to the market.
This little pig stayed home.
This little pig had roast beef.
This little pig had none.
This little pig cried wee wee wee all the way home.
here's a example from him but i don't understand it
import time
def myFunction():
print('In the function called my function')
time.sleep(2)
def yourFunction():
print('In the function called your function')
time.sleep(2)
#*********MAIN**********
print ('In the main part of the program')
time.sleep(2)
myFunction()
print ('Back in the main')
time.sleep(2)
yourFunction()
print ('Back in the main after your function')
please help if you can
Answer:
see picture below
Explanation:
I added a parameter to factor out the first bit of each sentence into a global variable. If you change for example 'pig' into 'monkey', all sentences will change.
(python) Given the formula for conversion from Celsius to Fahrenheit
Fahrenheit = 1.8 x Celsius + 32
Write a Python program that takes as input a temperature in degrees Celsius, calculates the temperature in degrees Fahrenheit, and display the result as output.
Answer:
initial_temp = float(input('Celsius Temperature: '))
final_temp = (initial_temp * 1.8) + 32
print(f'{final_temp} F')
explain 3 components of the Visual Basic IDE (6 marks)
Answer:
Explanation:
The IDE of Visual Studio 2008 contains numerous components, and it will take you a while to explore them. It’s practically impossible to explain in a single chapter what each tool, window, and menu command does. We’ll discuss specific tools as we go along and as the topics get more and more advanced. In this section, I will go through the basic items of the IDE — the ones we’ll use in the following few chapters to build simple Windows applications.
The IDE of Visual Studio 2008 contains numerous components, and it will take you a while to explore them. It’s practically impossible to explain in a single chapter what each tool, window, and menu command does. We’ll discuss specific tools as we go along and as the topics get more and more advanced. In this section, I will go through the basic items of the IDE — the ones we’ll use in the following few chapters to build simple Windows applications.The IDE of Visual Studio 2008 contains numerous components, and it will take you a while to explore them. It’s practically impossible to explain in a single chapter what each tool, window, and menu command does. We’ll discuss specific tools as we go along and as the topics get more and more advanced. In this section, I will go through the basic items of the IDE — the ones we’ll use in the following few chapters to build simple Windows applications.
The Edit menu contains the usual editing commands. Among these commands are the Advanced command and the IntelliSense command. Both commands lead to submenus, which are discussed next. Note that these two items are visible only when you’re editing your code, and are invisible while you’re designing a form.
What happens when text is added to grouped objects that is larger than an object ?
Answer:
You have to select the picture and pick the text at first.
Then press context menu key on a keyboard or right mouse button and choose group/ungroup point.
Choose group.
And finally you can select and resize the object and text simultaneously.
I need help to pick what programming language is best to make videogames
Answer:
In my opion its java script
Explanation:
suppose as a head software engineer you assign the job of creating a class to a subordinate. You want to specify thirty-eight different methods in which you are willing to detail the parameters each is to receive as well as what each returns. You, however, do not have the time to create the details of each method and wish to assign that work to the subordinate. What would be your best approach to ensure that the subordinate finishes the assigned job.
Answer:
jskjsjsjsjskdmsnjsnsnsns
Q.2 (A)
Write down the method for cooking pasta from the given ingredients.
% CUP
Ingredients and amounts
Dried pasta
Butter
Amul cheese spread
Milk
Salt
1 tablespoon
2-3 tablespoon
Va cup
pinch
ach line contains a letter o
Answer:
First u need to soften pasta by boiling it .
Butter 1 tablespoon.
Then Fry wet pasta , And add veggies or spices
When it's about to prepare ,
Add Amul cheese ( if u want to make cheese pasta)
Add a pinch of salt ( if u want) not necessary.
Milk is not necessary though.
I hope this helps a little bit
giving Brianlist (to the correct answers)help plesee question is what is keyboard (long paragraph)plzz don't spam with unnecessary answers !!!!thankyouuuuuuu:)
Answer:
Explanation:
A computer keyboard is an input device that allows a person to enter letters, numbers, and other symbols (these are called characters in a keyboard) into a computer. Using a keyboard to enter lots of data is called typing. A keyboard contains many mechanical switches or push-buttons called "keys".
What is Typing?
And
What is Economic?
Answer:
what is typing: the action or skill of writing something by means a typewriter or computer
what is economic:a branch of knowledge concerned with production,consumption,and transfer of wealth.
Please use the tables in the flights database. Your deliverable should include a single SQL query that I can run against a "fresh copy" of the tables in the flights database.
1. Write a script to select all data from the planes table.
2. Update the planes table so that rows that have no year will be assigned the year 2013. (missing values will display as NULL).
3. Insert a new record to the planes table with the following values:
Tailnum: N15501
Year: 2013
type: Fixed wing single engine
Manufacturer: BOEING
Model: A222-101
Engines: 3
Seats: 100
Speed: NULL (notice this is not a text value but truly the absence of any value: "empty". As such, don't use single or double quotes around NULL when inserting this value).
Engine: Turbo-fan
4. Delete the newly inserted record on step 3.
Answer:
The scripts are:
1. SELECT * FROM planes
2. UPDATE planes SET YEAR = 2013 WHERE year IS NULL
3. INSERT INTO planes (Tailnum, Year, type, Manufacturer, Model, Engines, Seats) VALUES ('N15501',2013,'Fixed wing single engine', 'BOEING', 'A222-101',3,100,NULL)
4. DELETE FROM planes WHERE Tailnum = 'N15501'
Explanation:
1. SELECT * FROM planes
To select all from a table, use select * from [table-name]. In this case, the table name is planes
2. UPDATE [tex]planes\ SET[/tex] YEAR = 2013 WHERE year IS NULL
To do this, we use the update query which is as follows:
UPDATE [table-name] SET [column-name]= [value] WHERE [column] IS NULL
So: the above query will update all YEAR column whose value is NULL to 2014
3. INSERT INTO planes (Tailnum, Year, type, Manufacturer, Model, Engines, Seats) VALUES ('N15501',2013,'Fixed wing single engine', 'BOEING', 'A222-101',3,100,NULL)
To insert is very straight foward.
The syntax is:
INSERT INTO [table-name] (column names) VALUES (values)
4. DELETE FROM planes WHERE Tailnum = 'N15501'
To do this, we use the update query which is as follows:
DELETE FROM [table-name] WHERE [column] = [value]
So: The above query will delete the entry in (3) above
what was his beliefs?
A belief is an attitude that something is the case, or that some proposition about the world is true.[1] In epistemology, philosophers use the term "belief" to refer to attitudes about the world which can be either true or false.[2] To believe something is to take it to be true; for instance, to believe that snow is white is comparable to accepting the truth of the proposition "snow is white". However, holding a belief does not require active introspection. For example, few carefully consider whether or not the sun will rise tomorrow, simply assuming that it will. Moreover, beliefs need not be occurrent (e.g. a person actively thinking "snow is white"), but can instead be dispositional (e.g. a person who if asked about the color of snow would assert "snow is white").[2]
There are various different ways that contemporary philosophers have tried to describe beliefs, including as representations of ways that the world could be (Jerry Fodor), as dispositions to act as if certain things are true (Roderick Chisholm), as interpretive schemes for making sense of someone's actions (Daniel Dennett and Donald Davidson), or as mental states that fill a particular function (Hilary Putnam).[2] Some have also attempted to offer significant revisions to our notion of belief, including eliminativists about belief who argue that there is no phenomenon in the natural world which corresponds to our folk psychological concept of belief (Paul Churchland) and formal epistemologists who aim to replace our bivalent notion of belief ("either we have a belief or we don't have a belief") with the more permissive, probabilistic notion of credence ("there is an entire spectrum of degrees of belief, not a simple dichotomy between belief and non-belief").[2][3]
Beliefs are the subject of various important philosophical debates. Notable examples include: "What is the rational way to revise one's beliefs when presented with various sorts of evidence?"; "Is the content of our beliefs entirely determined by our mental states, or do the relevant facts have any bearing on our beliefs (e.g. if I believe that I'm holding a glass of water, is the non-mental fact that water is H2O part of the content of that belief)?"; "How fine-grained or coarse-grained are our beliefs?"; and "Must it be possible for a belief to be expressible in language, or are there non-linguistic beliefs?".[2]
Structural Styles
Go to the Structural Styles section. Within that section create a style rule to set the background color of the browser window to rgb(151, 151, 151).
Create a style rule to set the background color of the page body to rgb(180, 180, 223) and set the body text to the font stack: Verdana, Geneva, sans-serif.
Display all h1 and h2 headings with normal weight.
Create a style rule for every hypertext link nested within a navigation list that removes underlining from the text.
Create a style rule for the footer element that sets the text color to white and the background color to rgb(101, 101, 101). Set the font size to 0.8em. Horizontally center the footer text, and set the top/bottom padding space to 1 pixel.
Solution :
For Structural Styles the browser's background color.
html {
background-color: rgb(151, 151, 151);
}
For creating style rule for the background color and setting the body text
body {
background-color: rgb(180,180,223);
font-family: Verdana, Geneva, sans-serif;
}
For displaying all the h1 as well as h2 headings with the normal weight.
h1, h2 {
font-weight: normal;
}
For create the style rule for all the hypertext link that is nested within the navigation list
nav a {
text-decoration: none;
}
For creating style rule for footer element which sets the color of the text to color white and the color of the background to as rgb(101, 101, 101). Also setting the font size to 0.8em. Placing the footer text to horizontally center , and setting the top/bottom of the padding space to 1 pixel.
footer {
background-color: rgb(101, 101, 101);
font-size: 0.8em;
text-align: center;
color: white;
padding: 1px 0;
}
/* Structural Styles At one place*/
html {
background-color: rgb(151, 151, 151);
}
body {
background-color: rgb(180,180,223);
font-family: Verdana, Geneva, sans-serif;
}
h1, h2 {
font-weight: normal;
}
nav a {
text-decoration: none;
}
footer {
background-color: rgb(101, 101, 101);
font-size: 0.8em;
text-align: center;
color: white;
padding: 1px 0;
}
Your program should include the following four functions:
check_length - This function should accept a password to evaluate as a parameter and should return a score based on the length of the password. A password that is less than 8 characters long gets a length score of 1. If it is between 8 and 11 characters long (inclusive), it gets a length score of 2. A password that is 12 characters or longer gets a length score of 3.
check_case - This function should accept a password to evaluate and return a case score of 1 or 2. If the letters in the password are all uppercase or all lowercase, the case score should be a 1. If there is a mix of uppercase or lowercase letters (or if there are no letters at all), it gets a case score of 2.
check_content - This function should accept a password to evaluate and return a content score. If the characters are all alphabetic characters, the content score is 1. If the characters include any numeric digits (either all numeric or a mix of letters and digits), the content score is 2. If there are any other types of characters (such as punctuation symbols), the content score is 3.
main - This function represents the main program. It accepts no parameters and returns no value. It contains the loop that allows the user to process as many passwords as desired. It function calls the other functions as needed, computing the overall score by adding up the scores produced by each function. All output should be printed in the main function.
python please
Answer:
def main():
pwd = input("Password: ")
print("Length: "+str(check_length(pwd)))
print("Case: "+str(check_case(pwd)))
print("Content: "+str(check_content(pwd)))
def check_length(pwd):
lent = len(pwd)
if lent < 8:
return 1
elif lent >=8 and lent <= 11:
return 2
else:
return 3
def check_case(pwd):
if(pwd.isupper() or pwd.islower()):
return 1
else:
return 2
def check_content(pwd):
if(pwd.isalpha()):
return 1
elif(pwd.isalnum()):
return 2
else:
return 3
if __name__ == "__main__":
main()
Explanation:
The main begins here
def main():
This prompts the user for password
pwd = input("Password: ")
This calls the check_length function
print("Length: "+str(check_length(pwd)))
This calls the check_case function
print("Case: "+str(check_case(pwd)))
This calls the check_content function
print("Content: "+str(check_content(pwd)))
The check_length function begins here
def check_length(pwd):
This calculates the length of the password
lent = len(pwd)
If length is less than 8, it returns 1
if lent < 8:
return 1
If length is less than between 8 and 11 (inclusive), it returns 2
elif lent >=8 and lent <= 11:
return 2
If otherwise, it returns 3
else:
return 3
The check_case function begins here
def check_case(pwd):
If password contains only uppercase or only lowercase, it returns 1
if(pwd.isupper() or pwd.islower()):
return 1
If otherwise, it returns 2
else:
return 2
The check_content function begins here
def check_content(pwd):
If password is only alphabet, it returns 1
if(pwd.isalpha()):
return 1
If password is only alphanumeric, it returns 2
elif(pwd.isalnum()):
return 2
If otherwise, it returns 3
else:
return 3
This calls the main function
if __name__ == "__main__":
main()
What is true about super computers?
Explanation:
Super Computer are expensive computer that are used to provide very quick results. Super computer are used in calculating complex mathematical calculations. Calculations such as weather forecast and Atomic energy research. Therefore Super Computer perform complex calculations rapidly.
What is your favorite anime ( All movies and episodes related to them count )
A. Seven Deadly Sins
B. Naruto
C. Dragon Ball
D. One piece
C. The misfit of the demon king academy
E. Classroom of the Elite
Answer:
B. Naruto
Explanation:
what precautions should be taken to make a computer more secure
Answer:
To make a computer more secure
Explanation:
we have following ways :
1)we should have anti virus to protect our computer.
2)we should not play or look computer for a long time because it destroy our files
Which term is defined by the total operating current of a circuit?
Answer:
OK PERO NOSE LM SOTTY BROTHER
Explanation:
What is
Computer Security
Answer:
Computer Security is the protection of computer systems and networks from information disclosure, theft of or damage to their hardware, software, or electronic data, as well as from the disruption or misdirection of the services they provide.
Explanation:
Answer:
the protection of computer systems and information from theft
Explanation:
Select the correct statement(s) regarding the signal-to-noise ratio (SNR).
A. SNR represents the ratio of transmit signal power over the noise power of all sources including thermal, impulse, IM, CCI, and crosstalk noise.
B. the noise (i.e., noise floor) in the signal-to-noise ratio, is a wideband noise product that is predominated by thermal noise.
C. the noise power, in the signal-to-noise ratio, occupies a narrow band in the frequency domain.
D. all of the above are correct statements.
Answer:
B. the noise (i.e., noise floor) in the signal-to-noise ratio, is a wideband noise product that is predominated by thermal noise.
Explanation:
Sound can be defined as mechanical waves that are highly dependent on matter for their propagation and transmission. Sound travels faster through solids than it does through either liquids or gases.
Signal-to-noise ratio (SNR) is simply the ratio of signal power to noise power or the ratio of desired information to the undesired signal. SNR doesn't have a unit i.e it is a unitless quantity.
Generally, the higher the signal-to-noise ratio (SNR), the better would be the quality of a signal.
Additionally, a negative signal-to-noise ratio (SNR) in decibel form simply means that the signal power is lesser than the noise power.
Hence, the correct statement regarding the signal-to-noise ratio (SNR) is that the noise (i.e., noise floor) in the signal-to-noise ratio, is a wideband noise product that is predominated by thermal noise.
Note: noise can be defined as an unwanted disturbance or undesired signal present in an electrical signal.
Use the drop-down menus to complete the statements about the recall option in Outlook 2016.
Recalling a message stops its delivery before the recipient
it.
It only works about half the time, and it only works when recipients are in the same
.
Once it is recalled, the
will get a message informing them of the recalled message.
Be sure to check your message before you send it, and assume it will be read within 30
of sending the message.
Answer:
Recalling a message stops its delivery before the recipient
opens it.
It only works about half the time, and it only works when recipients are in the same organization
.
Once it is recalled, the recipient will get a message informing them of the recalled message.
Be sure to check your message before you send it, and assume it will be read within 30 seconds of sending the message.
Explanation:
Description
Military time uses 24 hours for the entire day instead of 12 for am/pm separately. Military time is a 4 digit (base-10) integer with the following rules:
The first two digits show the hour (between 00 and 23) and
The last two digits show the minutes (between 00 and 59)
There is no colon separating hours from minutes.
Military time starts at 0000 in the morning and counts up
When we get to the afternoon, we use 1300 for 1:00 PM and 2300 for 11:00 PM.
When we get to midnight, the hour is 00 (not 24).
TASK: Write a program that reads two times in military format and prints the number of hours and minutes between the two times (See example below).
NOTE: Your program should consider the difference between the times IN THE SAME DAY. For example: The time difference between 2359 and 0000 is 23 hours and 1 minute (NOT 1 minute).
Detailed Requirements
• Compose a written document (MS Word Document) describing your algorithm, feel free include a diagram if you like
• The program should prompt for two times separately, then print the duration of time between (see sample output below).
• The program should check the input for the correct military time format:
. Make sure the hours are between 00 and 23.
. Make sure the minutes are between 00 and 59
. If the validity check fails, it should print an appropriate error and prompt again.
• Your program should use io manipulators to produce military time with leading zeroes. e.g. 9 am should be printed 0900 (not 900).
• More points will be awarded to an implementation that can produce an accurate result regardless of the order of the inputs.
• Do not produce runtime errors that abruptly end your program (crash)
• Include descriptive comments, neat indentation, proper spacing for good readability, and appropriate and consistently named variables.
• Program source should have a comment block at the top with the student name, section, and description of your program.
Please enter a time: 1sykdf
Military Tine Format Required: Bad input, try again.
Please enter a time: 2580
Military Tine Format Required: Hours must be between 2 and 23, try again
Please enter a time: 2365
Military Tine Format Required: Minutes must be between me and 59, try again
Please enter a time: 0900 First time 0900 accepted.
Please enter a time: jdkjs
Military Time Forest Required: Bad input, try again.
Please enter a time: 39573
Military Tine Format Required: Hours must be between 28 and 23, try again
Please enter a time: 1799
Military Tine Format Required: Minutes must be between me and 59, try again
Please enter a time: 1730 Second time: 1738 accepted.
Time difference between 1988 and 1732 ts 8 hours and 30 minutes Dismissed solder!
Note! When I change the order of the time inputs. I get the same result!
Answer:
from datetime import time, datetime, timedelta, date
for _ in iter(list, 0):
t1 = input("Please enter time one: ")
t2 = input("Please enter time two: ")
if t1.isdigit() == True and (int(t1[:2])<=23 and int(t1[2:]) <= 59)\
and t2.isdigit() == True and (int(t2[:2])<= 23 and int(t2[2:])<=59):
time_1 = time(hour=int(t1[:2]), minute=int(t1[2:]))
time_2 = time(hour= int(t2[:2]), minute=int(t2[2:]))
if time_1 > time_2:
diff = datetime. combine (date. today( ), time_1) - datetime. combine(date. today ( ), time_2)
else:
diff = datetime. combine (date. today( ), time_2) -datetime. combine(date. today ( ), time_1)
diff_list = str(diff).split(":")
del diff_list[2]
diff_t = "". join (diff_list)
print(diff_t)
break
if t1.isdigit() == False or t2.isdigit() == False:
print("Military Time Forest Required: Bad input, try again.")
continue
elif int(t1[:2])> 23 or int(t2[:2])> 23:
print("Military Tine Format Required: Hours must be between 00 and 23, try again")
continue
elif int(t1[2:])> 59 or int(t2[2:])> 59:
print("Military Tine Format Required: Minutes must be between me and 59, try again")
continue
Explanation:
The python Datetime package is used to manipulate date and time, creating immutable Datetime objects from the various python data types like integer and string. The block of code above is a conditional for-loop statement that gets two user time value inputs and prints out the difference as a string in Military forest time format.
explain five unique features of word processor
Explanation:
Typing, editing and printing different types of document . Formatting text , paragraph , pages for making attractive document .Checking spelling and grammar of document for making it error free.Inserting and editing picture , objects,etc. Adding watermark, charts,quick flip , etc1) Easy Typing : In MS Word, typing is so easy because :
we need not click enter button after the end of a line as in case of type writer. The word processor itself takes the matter to the next line of the document. This facility is called word wrapping.There is no limit for typing the matter in word processing. You can type the matter continuously without resorting to new page or file. But in a type writer, if you complete a page, you have to take another blank page and start typing.You can easily rectify mistakes as the typed matter appears on the screen.2) Easy : The document so typed can be stored for future use. The process of storing is called saving. We can preserve the document for any number of years in word processing.
3) Adding, Removing and Copying Test : Documents can be modified easily in MS Office. We need not strike off any word as in the case of type writer. We can easily place a new word in place of existing one. The new word or paras will automatically be adjusted in the place of deleted or modified text. We can also copy a part or whole of the matter from one file or document to another document.
4) Spell Check of words : The spellings of words in the document can be rectified automatically. We can find alternative words to our typed words. Not only that, even the grammatical errors can also be rectified in word processor.
5) Change the Style and Shape of Characters and Paragraphs : The documents in word processor can be made attractive and appealing because the shape and style of characters or letters in the documents can be changed according to our requirements. You can even change the gap between one line and other line in the document. This process is called line spacing. Not only the lines but also paragraphs can be aligned to make it more appealing to the readers. This facility is called alignment in word processing.
HOPE IT HELPS
PLEASE MARK ME BRAINLIEST ☺️
what is a computer?
an electronic device for storing and processing data, typically in binary form, according to instructions given to it in a variable program.
hope this helps
What type of role does the group leader have? Informal negative positive Formal
What is also known as a visual aid in a presentation?
A. background
B. animation
C. review
D. slide
E. template
Answer:
it is d slide
Explanation:
Given A=1101 and B=1001. What is the result of the boolean statement: A
AND B
Answer:
B (1001)
Explanation:
The AND operator gets you 1's where there are 1's in both inputs. So if you would "overlay" the two binary values, only 1001 remains.
Do drone batteries discharge 100% of their total capacity?
Why is myConcerto considered essential to Accenture's work with enterprise
systems?
Answer:
myConcerto can help clients envision, innovate, solution, deliver and support their transformation to an intelligent enterprise–providing the technology foundation to accelerate their journey and minimize risk along the way.
Hope it helps
Please mark me as the brainliest
Thank you
myConcerto is considered essential to the Accenture enterprise because it helps to do the following:
It can help the clients to envision more.It is useful for innovation.It provides solution.It helps to deliver and also support transformation to enterprises that make use of artificial intelligence.What is myConcerto?This platform is one that is digitally integrated. What it does is that it helps Accenture in the creation of great business outcomes.
Read more on Accenture here:
https://brainly.com/question/25682883
A tactful representation of opposing views is essential when writing for the opposition. True or false
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;}
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;
}
}