Question: In JAVA please program Problem 4-Write methods Submit a program called: directMethods.java 1. Create a method called time() that takes an integer (total number of
Problem 4-Write methods Submit a program called: directMethods.java 1. Create a method called time() that takes an integer (total number of seconds) and outputs to screen a clock in 24 hour format (hours, minutes and seconds). The return value should be the number of hours. If the number of seconds entered is greater than the number of seconds in a day, the method should return-1. 2. Create a method called prime() that checks if a number is prime or not. It should return true if it is prime and false otherwise. 3. Create a method called allFactors() that prints out all the factors of a given number. The return value should be the number of factors 4. Create a main method using these methods. Your main method should only contair three lines: System.out.println(time(18000)); System.out.println(prime(13)); System.out.println(allFactors(100))
Step by Step Solution
There are 3 Steps involved in it
Heres how you can implement the directMethodsjava progra... View full answer
Get step-by-step solutions from verified subject matter experts
