Examines the concept of a numerical palindrome

Assignment Help Basic Computer Science
Reference no: EM131548694

For this assignment your job is to create two class application that examines the concept of a numerical palindrome.

A numerical palindrome is a non-negative whole number that is the same forwards and backwards, e.g. 2332, 12321, etc. Here's the catch: suppose you do the following. Start with any positive whole number. If it's a palindrome, you're done; if it isn't, reverse the number, add the reversal to the original value, and test this new result. It it's a palindrome, you're done; otherwise repeat: reverse, add, and test again, and so forth. This process almost always leads, very quickly, to a palindrome

A note on how to structure your solution. A NumPal object MUST have four attributes: the current number, its reverse, the String version of the current number, and String version of the reverse of the current number. The numbers should be of type long, not int.

Here's a detailed account of what you need to do for this assignment. You must develop a complete class, NumPal, which works properly with the driver class above, and in that way allows you to turn integer inputs into numerical palindromes. Your submitted code must implement the following methods:

  • Implement the NumPal constructor. Notice that it takes a String argument, NOT an integer argument.
  • Implement the pal() method, which determines if a NumPal object represents a palindrome.
  • Implement the toString() method, which returns a String of the proper form (an example of toString output is given in the first sample run above for 552).
  • Implement the next() method, which - given a NumPal object - returns the next NumPal object according to the "reverse and add" method described above.
  • Implement a reverseString method, which takes a String, say s, as an argument, and returns the reverse of s. Thus reverseString("aabcd") should return the String dcbaa. The code you submit should use this method in an essential way. This method appears as an exercise at the end of Chapter 5 in the textbook.

One final comment. There are clearly many ways to structure a solution to this problem. We've chosen one, and you need to adhere to the pattern we've spelled out above. You may not alter the driver class in any way.

Reference no: EM131548694

Questions Cloud

Thomas-kilmann conflict mode instrument : Choose Thomas-Kilmann Conflict Mode Instrument (TKI) .The TKI is used to assess a person's behavior in conflict situations.
Would you rather use conditional or joint probability : When working with research, would you rather use conditional or joint probability? Explain.
Define revitalizing of business plans to assess new products : During this course, the writing and expansion of thought incited by Kuratko (2013) has re-energized concepts and principles I have a long subscribe.
What goals would you set for the sales staff : What behaviors would you advise ACI to look for in hiring ACI's sales staff? What goals would you set for the sales staff?
Examines the concept of a numerical palindrome : For this assignment your job is to create two class application that examines the concept of a numerical palindrome.
Explain the major geographical exposure : Include the nature of its products or services. Explain the major geographical exposure. Explain the major source of foreign exposure.
Discuss the kotter eight-step plan : As part of your reflection exercise for Week 8, reflect on a major change that you had experienced personally or at your workplace.
Discuss the greatest challenges to sound decision-making : Explain the incentives in this scenario. Were they effective? Discuss the greatest challenges to sound decision-making in your scenario.
Investing in employee security-training programs : Discuss what the results are for companies investing in employee security-training programs vs. those who don't.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd