Obtain a single digit to generate a numerology report

Assignment Help Computer Engineering
Reference no: EM132207502

Write a program that will add the digits of a person's birth date to obtain a single digit to generate a numerology report.

First: Get a Date

Numerology has been used since ancient times to shed light on relationships, health and global events. Each element in a birth date is believed to possess a special numerical significance. We are going to develop our own rudimentary numerology prediction program. The first thing to do is ask the user to enter a birth date to process.

You will need to indicate to your user that they need to enter the month, day and year in that order separated by spaces and forward slashes, which look like this: /. An example would be 12 / 25 / 2112. The spaces must be present between the numeric and character input.


Second: Validate the Date

The important and time-consuming portion of this program is validating your input from the user. This means that you need to check to make sure the month is between 1 and 12, the day is appropriate for the month, and the year is between 1880 and 2280, inclusive.

By "the day is appropriate for the month and year", this means that if a date of January 32nd is entered or a date of June 0th is entered, you should recognize and report that. This also means that you should check to see that if the year is a leap year, you should allow February 29th and if it's not a leap year, you should disallow February 29th. See the "Solution Suggestions" for a website that discusses leap years.

Allow the user to input the entire date before you validate it.

You should continuously re-prompt the user for a date until a valid date is entered. If one part of the date fails (month, day or year), re-prompt for the entire date again. Do not simply re-prompt for the offending part of the date. Output appropriate error messages for the incorrect dates. See the example runs for sample error messages.


Third: Crunch the Date

Then, you need to calculate a single digit from the birth date. For example if your birth date is 3/19/1955 you add 3+1+9+1+9+5+5 to get 33. You would then break this apart and add 3+3 to get 6.

You will need to be careful because it is possible to have to "fold" the number more than just once, as in the above example. For example, if the birth date was 7/5/1942, you would add up the individual digits 7+5+1+9+4+2 to get 28, then you would need to add 2 + 8 to get 10. This is still a two-digit number, and needs to be added again - 1 + 0 - to get a single-digit result of 1.

You can simplify the process by adding the month day and year together first (i.e., 7+5+1942, to get 1954) and then breaking down and adding that result (1+9+5+4), which results in 19, which needs to be broken down again to get 1+9 which results in 10, which then results in 1+0, or 1. You should never have to crunch a number more than 3 times and will usually only need to add the digits once.


Output Specifications

Once you have obtained the single digit you are going to print out a numerology forecast for that number. If your number was 1, you would print out the numerology report for the number 1. Use the following one-line format for your output:

=1= Neither give cherries to pigs nor advice to a fool.

For your output, have the text =X= start the line, where X is the number of the numerology report surrounded immediately by equals signs and followed by a space. Then, issue your numerology forecast on the remainder of the line.

Use your own numerology forecasts for each number. Have fun, be creative, don't be mean-spirited and please keep the content to a PG-13 format (i.e., no foul language and nothing that is outright offensive; remember not to offend your instructor).

Solution Suggestions

It might actually be easier to work backwards solving this program, like this, checking each step as you complete it:

o The first thing you could do is write a switch statement that handles 9 possible numerology forecasts. Test this switch statement by using exact values for the switch's variable to make sure it works and outputs all 9 numerology forecasts before moving on.

o Then add the code to take a date and crunch it down to a single digit. This code should come before your switch statement. For simply testing this code, don't worry about validating the date or input format yet; declare three variables (for example: month, date, year), read in the date to process from the user and then feed that result into the switch statement you've already developed and that you know works from the previous step.

o Finally, add code to validate the date that you read from the keyboard before crunching it. Validation will need to include tests for the month, day and year as well as for using forward slashes between those pieces of information.

Reference no: EM132207502

Questions Cloud

Social media effectively while avoiding the clutter : How can businesses leverage social media effectively while "avoiding the clutter"?
Is this employee eligible for unemployment insurance : He filed for unemployment insurance and his claim was contested. Is this employee eligible for unemployment insurance? Why or why not?
What is difference between job security and career security : What is the difference between job security and career security? Which one would you rather have and why?
What type of training partnership exists : What type of training partnership exists between businesses, government, and education? Be sure to write response in third person narrative.
Obtain a single digit to generate a numerology report : Write a program that will add the digits of a person's birth date to obtain a single digit to generate a numerology report.
Write a procedure that performs simple encryption : Write a procedure that performs simple encryption by rotating each plaintect byte a varying number of positions in different directions.
Calculate the natural rate of unemployment : Calculate the natural rate of unemployment for this example. Now assume that pet = ?pt-1 and suppose ? is initially equal to 0. Suppose that the rate.
Golden girl of metropolitan government : Krista Acklen was the “golden girl” of a metropolitan government in a large midwestern city.
Calculate the average of the first ten terms sequence : Write a piece of code that calculates the average of the first 10 terms sequence using a for loop, and then prints the resulting average.

Reviews

Write a Review

Computer Engineering Questions & Answers

  How would you characterize the page-fault rate

Consider a system that uses pure demand paging. Once the working set for a process is loaded into memory, how would you characterize the page-fault rate?

  Establish a sample hardware asset list for the company

You are part of a disaster recovery team charged with completing the asset inventory at a small business that primarily sells a small selection of products.

  What features of the numerical problems lead to performance

What features of both the numerical problems and vector computers lead to this high performance?

  Discuss configuration steps needed to install and configure

Discuss the configuration steps needed to install and configure a highly available DNS and DHCP landscape.

  Backgroundjulia and robert have made progress in the

backgroundjulia and robert have made progress in the development of a strategic plan for kahuna cleaning supply. robert

  What transform a network to a secure network

How do I transform a network to the secure network? What tools should I have and what kind of hardware do I need to have a basic secure network.

  The course project will involve producing a professional

the objective of the project is to recommend an upgraded wireless technology for a major telecommunication carrier.

  What is the difference between a job and a process

What is the difference between a job and a process? How do you suspend the foreground job and move a suspended job to the background.

  Write a program to evaluate polynomials using homers method

Write a program to evaluate polynomials using Homer's method, where the polynomials are represented with linked lists.

  What business to consumer and consumer to business items

Marketing and the owner of the CyberCafe would like to have items both in our shop and in Internet ecommerce site. What Business to Consumer and Consumer to Business items would your team recommend. What are the possibilities for fulfilment?

  Review problem related to course conclusion

You have just completed 10 weeks of a computer and interaction design course. Imagine you have been asked to create a one-day training course highlighting.

  Develop incident response plan and procedures

Develop incident response plan and procedures for a variety of digital forensic situations. Evaluate environment for global/international influences.

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