Answer:
The solution code is written in Python.
<u>First version (user input through terminal)</u>
- food_price = float(input("Enter food price: "))
- sales_tax = food_price * 0.07
- tips = food_price * 0.15
- total_cost = food_price + sales_tax + tips
- print("Food price: $" + str(food_price))
- print("Sale tax: $" + str(sales_tax))
- print("Tips: $" + str(tips))
- print("Total cost: $" + str(total_cost))
- print("\n")
<u>Second version (input from text file)</u>
- with open("text.txt") as file:
- data = file.readlines()
- for r in data:
- food_price = float(r)
- sales_tax = food_price * 0.07
- tips = food_price * 0.15
- total_cost = food_price + sales_tax + tips
- print("Food price: $" + str(food_price))
- print("Sale tax: $" + str(sales_tax))
- print("Tips: $" + str(tips))
- print("Total cost: $" + str(total_cost))
- print("\n")
Explanation:
<u>First version</u>
In the first version of code, we can create all the necessary variables to hold the value of food price, sales tax, tips and total cost (Line 1 -4). Please note we get the food price using the input() function to prompt user to enter the value through terminal (Line 1).
Next display the values using print() function (Line 5 - 8)
<u>Second version</u>
The second version of code is similar to the first version except that we need to change the code to accept input from a text file (Line 1 -2) instead of using the input function.
We presume there might be multiple values in the text file and therefore it is recommended to use readlines() method to get the value line by line from the text file (Line 2) and use for loop to traverse through each row of food price value and calculate the sales tax, tips and total cost (Line 4-7).
Answer:
I do believe so
Explanation:
Most websites have this, as far as I know
Answer:
<em>C</em>
Explanation:
Option <em>A </em>is used for line spacing.
Option <em>B </em>is used for right indent.
Option <em>C</em> is used for right paragraph alignment.
Option <em>D</em> is used for bullet points.
The button used for paragraph alignment would be option <em>C</em>.
Answer:
If the next of first is null then
TRUE.
else
FALSE.
Explanation:
The return type of the method operation is boolean so it can only return True or False.
What we are checking inside the method is that the next of the first is null or not.
If the next of the first is null then the method will return true otherwise it will return false.
This is full analysis of the method operation.
Answer:
D. placeholder
Placeholder are like the field you enter your username and passwords and etc. They can be easily understood my the name itself!
Hope this is the correct answer!
Bye!