Answer:
It's up to personal preference.
Explanation:
iPhone/Apple gives more compliments to security than Android.
Android has more friendly user GUI and dev tools.
Answer:
None of the mentioned options
Explanation:
- If we define a method in a derived class with same declaration type as that of base class then it is said to be overriding a function which behaves differently which will depend on the object which is calling the method.
- Option a,b and c are not any kind of methods we implement using coding.
- Option d is done when number or data types of parameters are different than the declaration of the base type.
Answer:
if(revenue.cents - expenses.cents < 0){
profit.dollars = revenue.dollars - expenses.dollars - 1;
profit.cents = 1 - revenue.cents - expenses.cents;
}
else{
profit.dollars = revenue.dollars - expenses.dollars;
profit.cents = revenue.cents - expenses.cents;
}
Explanation:
We know that profit is given as: revenue - expenses from the question.
From the given expression above;
if(revenue.cents - expenses.cents < 0)
then profit.dollar will be revenue.dollars - expenses.dollars - 1; the 1 is to be carry over to the cent part. And the profit.cent will be 1 - revenue.cents - expenses.cents;
else the profit.dollars and the profit.cent is computed directly without needing to carry over:
profit.dollars = revenue.dollars - expenses.dollars;
profit.cents = revenue.cents - expenses.cents;
Answer:
def prompt_number():
while True:
number = int(input("Enter a number: "))
if number >= 0:
break
return number
def compute_sum(n1, n2, n3):
total = n1 + n2 + n3
return total
n1 = prompt_number()
n2 = prompt_number()
n3 = prompt_number()
result = compute_sum(n1, n2, n3)
print(result)
Explanation:
Create a function named prompt_number that asks the user to enter a number until a positive number or 0 is entered and returns the number
Create a function named compute_sum that takes three numbers, sums them and returns the sum
Ask the user to enter three numbers, call the prompt_number() three times and assign the values
Calculate the the sum, call the compute_sum and pass the numbers as parameters
Print the result