Discover
Questions library
Collections library
Find online teacher
login
Discover
questions library
Find online teacher
login
Introduction to Java Programming, Comprehensive Version (10th Edition)
by
Y. Danial liang
Edition:
10th edition
ISBN13:
978-0133761313
ISBN10:
0133761312
772
Java programming
Home
Books
Introduction to Java Programming, Comprehensive Version (10th Edition)
Similar Books
No books found
Title
Chapter: 6 /
Q: 24
(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
Chapter: 6 /
Q: 25
(Convert milliseconds to hours, minutes, and seconds) Write a method that converts milliseconds to hours, minutes, and seconds using the following header:
Chapter: 6 /
Q: 26
(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
Chapter: 6 /
Q: 27
(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
Chapter: 6 /
Q: 28
(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:
Chapter: 6 /
Q: 29
(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:
Chapter: 6 /
Q: 30
(Game: craps) Craps is a popular dice game played in casinos. Write a program to play a variation of the game, as follows:
Chapter: 6 /
Q: 31
(Financial: credit card number validation) Credit card numbers follow certain patterns. A credit card number must have between 13 and 16 digits. It must start with:
Chapter: 6 /
Q: 32
(Game: chance of winning at craps) Revise Exercise 6.30 to run it 10,000 times and display the number of winning games
Chapter: 6 /
Q: 33
(Current date and time) Invoking System.currentTimeMillis() returns the elapsed time in milliseconds since midnight of January 1, 1970. Write a program that displays the date and time. Here is a sample run:
total questions:
772
Previous
16
17
18
19
20
Next
Questions
772
Views
Best Answers
299
Points
5
×
Close
add reason
reason