Sample Java Program to Calculate Perfect Square for a Number

Download Solution: Click to Download Solution
Solution File Name: CalculatePerfectSquareNumber.docx
Unzip Password: prestobear.com

Program:
Sample Java Program to Calculate Perfect Square for a Number


1. Ex117Number.java
import java.util.ArrayList;
import java.util.Scanner;

/*
 * Write a program that prompts the user to enter an integer
 * m and find the smallest integer n such that m * n is a perfect square
 * 
 * Store all smallest factors of m into an array list. n is the product of the factors that 
 * appear an odd number of times in the array list. For example, consider m = 90,
 * store the factors 2, 3, 3, 5 in an array list. 2 and 5 appear an odd number of times
 * in the array list. So, n is 10
 */

public class Ex117Number {

	/*
	 * The main method to run the application
	 */
	public static void main(String[] args) {

	}

	/*
	 * Count the smallest
	 */
	private static int smallestSquare(ArrayList factors) {

	}

	/*
	 * Remove the Duplicate
	 */
	private static ArrayList removeDuplicates(int[][] m) {

	}

	/*
	 * Search for the number
	 */
	private static void search(int[][] m, int number) {

	}

	/*
	 * Copy the factor
	 */
	private static int[][] copy(ArrayList factors) {

	}

	/*
	 * Get the factor
	 */
	private static void getFactors(int m, ArrayList factors) {

	}
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.