(Geometry: n-sided regular polygon) In an n-sided regular polygon all sides have the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). Design a class named RegularPolygon that contains:
- A private int data field named n that defines the number of sides in the polygon with default values 3. DEVAMINI OKU »
(The Rectangle class) Design a class named Rectangle to represent a rectangle. The class contains:
- Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height.
- A no-arg constructor that creates a rectangle with default values. DEVAMINI OKU »
(Geometry of a regular polygon) A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon is DEVAMINI OKU »
(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: DEVAMINI OKU »
(Convert milliseconds to hours, minutes, and seconds) Write a method that converts milliseconds to hours, minutes and seconds using the following header:
public static String convertMillis(long millis)
The method returns a string as hours:minutes:seconds. DEVAMINI OKU »
(Math: approximate the square root) There are several techniques for implementing the sqrt method in the Math class. On 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:
nextGues = (lastGuess + n / lastGuess) / 2 DEVAMINI OKU »
(Decimal to Binary) Write a program that prompts the user to enter a decimal integer and displays its corresponding binary value. Don’t use Java’s Integer.toBinaryString(int) in this program. Your program must have the following method.
public static String toBinary(int n) DEVAMINI OKU »