Should be easy to write this program. You need to define function that takes number as input and use if else condition to decide what to print.
For example in Python:
def checkCarMileage(mileage):
if mileage > 100000:
print("clunker!")
else:
print("buy it!")
Answer:
0
Explanation:
The statement, print(8 % 4) will produce the output 0 ;
The print statement is an inbuilt function which is used to output a typed string or display result of a Mathematical calculation and so on.
The expression in the print statement gives 0;
8%4 means, the remainder when 8!is divided by 4 ; 8 /4 gives 2 without a remainder. Meaning that :
8%4 = 0
Hence, print(8 % 4) = 0
Answer:
You can answer this very easily by considering which of the circumstances affect the end user and which affect the developer:
1) Didn't use comments in the code
- affects developers
2) User complaints about language used in the program
- affects users
3) The variables have meaningless names
- affects developers
4) The program should have used a loop
- affects developers
5) The numeric results are incorrect
- affects users
Your answers then are 2 and 5, spoken languages and incorrect output will very much affect the user experience.
Answer:
TAX_RATE = 0.20
STANDART_DEDUCTION = 10000.0
DEPENDENT_DEDUCTION = 3000.0
gross_income = float(input("Enter the gross income: "))
number_of_dependents = int(input("Enter the number of dependents: "))
income = gross_income - STANDART_DEDUCTION - (DEPENDENT_DEDUCTION * number_of_dependents)
tax = income * TAX_RATE
print ("The income tax is $" + str(round(tax, 2)))
Explanation:
Define the <em>constants</em>
Ask user to enter the <em>gross income</em> and <em>number of dependents</em>
Calculate the <em>income</em> using formula (income = gross_income - STANDART_DEDUCTION - (DEPENDENT_DEDUCTION * number_of_dependents))
Calculate the <em>tax</em>
Print the <em>tax</em>
<em />
round(number, number of digits) -> This is the general usage of the <em>round</em> function in Python.
Since we need <u>two digits of precision</u>, we need to modify the program as str(<u>round(incomeTax, 2</u>)).
Paragraphs are usually separated by blank space.
Hope this is what you were looking for :)