Answer:
total = 0
for i in range(4):
bill = float(input("Enter bill for quarter " + str(i+1) + ": "))
total += bill
average = total / (4 * 3)
if average > 75:
print("Average monthly bill is $" + str(average) + ". Too much water is being used")
if 25 <= average < 75:
print("Average monthly bill is $" + str(average) + ". A typical amount of water is being used")
if average < 25:
print("Average monthly bill is $" + str(average) + ". Thank you for conserving water")
Explanation:
*The code is in Python.
Create a for loop that asks the user to enter the bill for 4 quarters and calculate the total of the bills
Calculate the average monthly bill, divide the total by 12
Check the average for the given conditions. Depending on its value print the required message along with the average monthly bill
Answer:
#include<stdio.h>
void ConvertFahrenheit(float);
void main()
{
float fahrenheit_temp;
printf("Input the temperature in Fahrenheit: ");
scanf("%f", &fahrenheit_temp);
ConvertFahrenheit(fahrenheit_temp);
}
void ConvertFahrenheit(float fahren) {
float c, k;
c = (fahren - 32)/1.8;
k = (fahren + 459.67)/1.8;
printf("Celsius = %f\n", c);
printf("Kelvin = %f", k);
}
Explanation:
- Inside the main function, take the temperature in Fahrenheit as an input from user and call the ConvertFahrenheit function by passing it the fahrenheit_temp variable as an argument.
- Create the ConvertFahrenheit function for the conversion and convert the fahrenheit value to the Celsius and Kelvin by using their conversion formulas respectively.
- Lastly, display the result in Celsius and Kelvin.
i am sup by the way. so im guessing i win?
Types in java are divided into two categories. the primitive types are boolean, byte, char, short, not, long, float, and double. all other types are REFERENCE types