Discover
Questions library
Collections library
Find online teacher
login
Discover
questions library
Find online teacher
login
Popular searches:
if-else
class-diagram
flowchart
Polymorphism
Home
Questions
Questions
Study lists
Ashoor Questions
555 Questions
(Game: craps) Craps is a popular dice game played in casinos. Write a program to play a variation of the game, as follows:
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
154
(Twin primes) Twin primes are a pair of prime numbers that differ by 2. For example, 3 and 5 are twin primes, 5 and 7 are twin primes, and 11 and 13 are twin primes. Write a program to find all twin primes less than 1,000. Display the output as follows:
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
245
(Mersenne prime) A prime number is called a Mersenne prime if it can be written in the form 2p - 1 for some positive integer p. Write a program that finds all Mersenne primes with p≤ 31 and displays the output as follows:
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
452
(Emirp) An emirp (prime spelled backward) is a nonpalindromic prime number whose reversal is also a prime. For example, 17 is a prime and 71 is a prime, so 17 and 71 are emirps. Write a program that displays the first 100 emirps. Display 10 numbers per line, separated by exactly one space, as follow
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
283
(Palindromic prime) A palindromic prime is a prime number and also palindromic. For example, 131 is a prime and also a palindromic prime, as are 313 and 757. Write a program that displays the first 100 palindromic prime numbers. Display 10 numbers per line, separated by exactly one space, as follows
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
297
(Convert milliseconds to hours, minutes, and seconds) Write a method that converts milliseconds to hours, minutes, and seconds using the following header:
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
300
(Display current date and time) Listing 2.7, ShowCurrentTime.java, displays the current time. Improve this example to display the current date and time. The calendar example in Listing 6.12, PrintCalendar.java, should give you some ideas on how to find the year, month, and day
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
266
(Occurrences of a specified character) Write a method that finds the number of occurrences of a specified character in a string using the following header:
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
185
(Math: approximate the square root) There are several techniques for implementing the sqrt method in the Math class. One such technique is known as the Babylonian method. It approximates the square root of a number, n, by repeatedly performing a calculation using the following formula:
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
309
(Phone keypads) The international standard letter/number mapping for telephones is shown in Programming Exercise 4.15. Write a method that returns a number, given an uppercase letter, as follows:
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
173
(Count the letters in a string) Write a method that counts the number of letters in a string using the following header:
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
210
(The MyTriangle class) Create a class named MyTriangle that contains the following two methods:
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
236
(Check password) Some websites impose certain rules for passwords. Write a method that checks whether a string is a valid password. Suppose the password rules are as follows:
Java programming
2022-06-04
Answers
30
Question
40
Followers
30
0
1
251
Total:
555
Previous
16
17
18
19
20
Next
Go