Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

A Palindrome is a word (or a number) that reads the same backwards. In this assignment you will be writing a program that repeatedly prompts a user for a positive integer number and tests whether the number is a palindrome. Your program should convert the integer value given by the user into an int array storing each digit of the number in the appropriate element of the array. It should then check to see whether the array is a palindrome. Your program should follow the guidelines given below.

1. Compose a method called getSize( int num ) that takes an integer number as input argument and returns the number of digits in that number. For e.g., getSize( 234 ) should return 3 and getSize( 76 ) should return 2.

2. Compose a method called fillArray( int num, int[] intArray ) that takes an integer number and an integer array argument and fills the array with the appropriate digits of the number. For e.g., calling the above method fillArray( 87432, intArray ) would set intArray[0] to the value 8, intArray[1] to 7, ..., and intArray[4] to 2.

3. Compose a boolean method called isPalindrome( int[] intArray ) that takes an integer array argument and returns the value true if the array is a palindrome else returns false.

4. Finally, write the main method that prompts the user repeatedly for an integer number, uses the getSize method to find out the number of digits in that number, allocates the int array for that size, calls the method fillArray to populate the array with the digits of the number, calls the isPalindrome method to find out whether the array is a palindrome, and prints out the result. Your program should terminate when the user enters -99.

Notes:

1. In Java you can allocate an array using a variable for the size, i.e., int[] intArray = new int[size]; where size is an int variable.

2. You SHOULD NOT use any methods from either the String or the Arrays class in your program.

Compose the program in JOption pane.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92387215
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

The police lieutenant in charge of the traffic division

The police lieutenant in charge of the traffic division reviews the number of traffic citations issued by each of the police officers in his division. He finds that the mean number of citations written by each officer is ...

Is it okay too copy a fellow classmate programming code

Is it okay too copy a fellow classmate programming code when you are stuck? Will that break a school honesty policy? Please explain

Question do you support the development and implementation

Question : Do you support the development and implementation of biometric optical surveillance system (BOSS) as a crowd surveillance tool for police departments? The response must be typed, single spaced, must be in time ...

Question please assist with discussion questions please

Question: Please assist with discussion questions. Please answer following questions with at least 3 paragraph response. Thank you. Access control starts first with assessing risks so you can properly identify potential ...

Question what is the relation between virtual memory a

Question : What is the relation between virtual memory, a memory map, physical memory and swapping to secondary memory? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow ...

Question a small financial focused business is looking to

Question : A small, financial focused business is looking to organize and secure its network. It currently has a single public IP address from a local telecom. Construct an argument as to how you think a company should e ...

Sorting algorithms are one kind of algorithm whose

Sorting algorithms are one kind of algorithm whose performance may depend upon the data. Choose one of the sorting algorithms or any other algorithm and explain whether the there are any differences in the best, average ...

Searching algorithm - which to use for this problemthe

Searching Algorithm - Which to use for this problem? The original problem was: You get a job with a small e-commerce company. b) The customer base has grown to 8,000,000 customers. Jorge now insists that the sorting algo ...

Suppose kelvin has seven controls listed as the top tier of

Suppose Kelvin has seven controls listed as the top tier of project initiatives. At his next meeting with Charlie, he provides a rank-ordered list of these controls with projected losses over the next 10 years for each i ...

There are 30 male democrats and 14 female democrats 2 male

There are 30 male Democrats and 14 female Democrats, 2 male Independents and zero female Independents, 48 male Republicans and 6 female Republicans. Find P (M ∩ D)

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As