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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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