4. (25) Write a Java program: (25 = 4(a) + 3(b) + 4(c) + 4(d) +3(e) + 3() + 4(g)) a. Randomly generate a 3-digit integer number (a 3-digit number is a number in range [100, 999]). Store this number in variable rn. Display rn. 1|Page b. Check if rn is divisible by 5 or 11 but not both. Display message: “[rn-value] is divisible by 5 or 11 but not both" or message “[rn-value] is not divisible by 5 or 11 but not both." c. Check if rn is divisible by at least 2 of the following numbers: 3, 7, 11, 13. Display message “[rn- number] is divisible by at least 2 numbers" or “[rn-value] is not divisible by at least 2 numbers".

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

in java eclipse ide can you insert the numbers in the code  please

4. (25) Write a Java program: (25 = 4(a) + 3(b) + 4(c) + 4(d) +3(e) + 3(f) + 4(g))
a. Randomly generate a 3-digit integer number (a 3-digit number is a number in range [100, 999]). Store
this number in variable rn. Display rn.
1|Page
b. Check if rn is divisible by 5 or 11 but not both. Display message: “[rn-value] is divisible by 5 or 11 but
not both" or message “[rn-value] is not divisible by 5 or 11 but not both."
c. Check if rn is divisible by at least 2 of the following numbers: 3, 7, 11, 13. Display message “[rn-
number] is divisible by at least 2 numbers" or “[rn-value] is not divisible by at least 2 numbers".
d. Calculate the square, the square root, and the cube of rn. Display the following messages:
"The square of number [rn-value] is [square-value]*
"The square root of number [rn -value] is [square-root-value]"
"The cube of number [rn -value] is [cube-value]
e. Extract digits from rn, Display these 3 digits.
f. Check if the rn is a palindrome number. Display result. (A 3-digit number is palindrome if the first digit
and the last digit are the same in this number).
g. Check if digits from 100's place to l's place in rn are sorted. The digits are sorted in a 3-digit number if:
di00 > d10 2 di or d100 < d10 < di
where d100, d10, di are digits at 100's, 10°s and l's places in rn.
Display message to show result
Transcribed Image Text:4. (25) Write a Java program: (25 = 4(a) + 3(b) + 4(c) + 4(d) +3(e) + 3(f) + 4(g)) a. Randomly generate a 3-digit integer number (a 3-digit number is a number in range [100, 999]). Store this number in variable rn. Display rn. 1|Page b. Check if rn is divisible by 5 or 11 but not both. Display message: “[rn-value] is divisible by 5 or 11 but not both" or message “[rn-value] is not divisible by 5 or 11 but not both." c. Check if rn is divisible by at least 2 of the following numbers: 3, 7, 11, 13. Display message “[rn- number] is divisible by at least 2 numbers" or “[rn-value] is not divisible by at least 2 numbers". d. Calculate the square, the square root, and the cube of rn. Display the following messages: "The square of number [rn-value] is [square-value]* "The square root of number [rn -value] is [square-root-value]" "The cube of number [rn -value] is [cube-value] e. Extract digits from rn, Display these 3 digits. f. Check if the rn is a palindrome number. Display result. (A 3-digit number is palindrome if the first digit and the last digit are the same in this number). g. Check if digits from 100's place to l's place in rn are sorted. The digits are sorted in a 3-digit number if: di00 > d10 2 di or d100 < d10 < di where d100, d10, di are digits at 100's, 10°s and l's places in rn. Display message to show result
Expert Solution
steps

Step by step

Solved in 2 steps with 1 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.
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