Question: Our example program is about the Dateable Equation. There is a common rule of thumb that you should not date a person who is younger
Our example program is about the Dateable Equation. There is a common rule of thumb that you should not
date a person who is younger than seven plus your age divided by two. The Dateable Equation is:
DateableAge YourAge
The labexample.cpp program calculates the lowest dateable age for a given person's age. Open this program
in a C IDE Integrated Development Environment Read and understand the code and run the program. Try
changing the given age to see the dateable age for different ages.
Notice that the Dateable Age is always an integer. If your age is an odd number, dividing it by two should result
in a decimal number, so why is the Dateable Age always an integer? The reason is that in C when you divide
two integers the result is an integer the decimal part is truncated Even if the dateable variable was of type
double, the result of the division would not have a decimal part. In order to have a decimal result from division,
at least one of the numbers involved in the division must be a floating point number such as type double and if
we are saving the result into a variable, the variable must be a floating point type. In this case an integer is the
correct result because we always deal with ages as whole numbers. But in other cases integer division will give
an incorrect result. In another lab we will look at an example where integer division results in an incorrect
result.
Your Program
In this program you will calculate your magic number. Your magic number is calculated by multiplying the
month of your birth by the year of your birth, and taking the modulus of that result and the day of your birth.
The equation is:
MagicNumber month year day
Open labFMLcpp in your IDE and implement the algorithm provided in the source code as comments.
Note:
Do NOT remove or modify the statements that I use to test certain things in your program.
Notice how we use descriptive variable names so it is easy to tell the meaning of the variable.
You must use the variables above for the calculation and printing. Do NOT use any literal numbers in
your calculation
Run my sample solution to know how your program must behave. Pay attention to the input and the
output formats. Your solution must behave exactly like mine.
Carefully analyze the following figure and use it as a reference to ensure you do the right things.
CSCI Spring Mr Gustavo Dietrich
Test and compare your solution with mine for different birthdates to ensure they always produce the
same outputs.
Include at the top of the program the comments shown below with your information name class and section
number, etc.
Name:
Date:
Class:
Semester:
CSCI Instructor:
Program Name: Magic Number
Program Description: Calculate a person's magic number based on their birthda
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
