Import java.util.Scanner;
public class MinutesConversion {
private static Scanner inputDevice;
public static void main(String[] args) {
int minutes, hours;
float days; // float for decimal point
inputDevice = new Scanner(System.in);
System.out.println("Please enter minutes for conversion >> ");
minutes = inputDevice.nextInt();
hours = minutes / 60;
days = hours / 24.0f;
System.out.println(+ minutes + " minutes is " + hours + " hour(s) or" + days " days");
}
}
Answer:
Behaviour
Style
Structure
Explanation:
Above are the three primary separation of concerns for a web application at client side.
Structure --> we can define the structure of the application at client side using HTML
style-->style is used to give some styling information like font,color,headings so on at client side .In general we use CSS to do this at client side
Behaviour--> it actually defines the functionality of the elements at client side like when we click button what it should do.We will use JavaScript to define the behaviours at client side
Answer:
count_p = 0
count_n = 0
total = 0
while True:
number = int(input("Enter an integer, the input ends if it is 0: "))
if number == 0:
break
else:
total += number
if number > 0:
count_p += 1
elif number < 0:
count_n += 1
print("The number of positives is: " + str(count_p))
print("The number of negatives is: " + str(count_n))
print("The total is: " + str(total))
print("The average is: " + str(total / (count_p + count_n)))
Explanation:
Initialize the variables, count_p represens the number of positives, count_n represents the number of negatives, and total represents the total of the numbers
Create a while loop iterates until the user enters 0. If the number is not 0, then add it to the total. If the number is greater than 0, increase count_p by 1. If the number is smaller than 0, increase count_n by 1.
When the loop is done, print the count_p, count_n, total, and average