This program will determine if a number is divisible by 5 or not. This should be a simple task by now, but this time you will use a static method to do the checking. The method should be called divFive and will take in one integer. The code inside your method will check to see if the number passed is evenly divisibly by 5. If it is, the method will return a boolean true. If not, a boolean false. (The return type will be boolean, not a String.) In your main method, you will ask the user for input, accept the input, and then call your divFive method, passing in the user’s integer. With the Boolean result that you get back from the divFive method, you should have code that will print “Divisible by 5” if a true is returned and “Not divisible by 5” if a false is returned. This program MUST have a try/catch block to: Catch wrong data types (input mismatch) Catch values 0 or less (custom exception) The try/catch block should go in your main method since this is where you are getting the user input. Make sure it’s in a loop so that you can keep asking for input if the user does not enter something valid. Your whole program does NOT need to loop continuously but you DO need a loop for your try/catch so that we can continue to request an appropriate input if the user does not follow directions.   in java

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
  1. This program will determine if a number is divisible by 5 or not. This should be a simple task by now, but this time you will use a static method to do the checking.

  2. The method should be called divFive and will take in one integer. The code inside your method will check to see if the number passed is evenly divisibly by 5. If it is, the method will return a boolean true. If not, a boolean false. (The return type will be boolean, not a String.)

  3. In your main method, you will ask the user for input, accept the input, and then call your divFive method, passing in the user’s integer.

  4. With the Boolean result that you get back from the divFive method, you should have code that will print “Divisible by 5” if a true is returned and “Not divisible by 5” if a false is returned.

  5. This program MUST have a try/catch block to:

    1. Catch wrong data types (input mismatch)

    2. Catch values 0 or less (custom exception)

  6. The try/catch block should go in your main method since this is where you are getting the user input. Make sure it’s in a loop so that you can keep asking for input if the user does not enter something valid.

  7. Your whole program does NOT need to loop continuously but you DO need a loop for your try/catch so that we can continue to request an appropriate input if the user does not follow directions.

 

in java

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education