I need to Create the flowchart and pseudocode for a program that accepts a user’s birth month and year and passes them to a method that calculates the user’s age in the current month and returns the value to the main program to be displayed. And apparently i need to also make a working version of this program in Python.
Pseudocode:
Function main()
BEGIN
Read User birth month and
year
ageInMonths <-
calculateAge(month, year)
Print years (ageInMonths /
12)
Print months (ageInMonths %
12)
END
Function calculateAge(month,
year)
BEGIN
currentMonth <- Get Current
Month
currentYear <- Get Current
Year
ageYears <- (currentYear -
year)
If currentMonth < month
Then
ageMonths <-
(12 - (month - currentMonth))
ageYears <-
ageYears - 1
Else
ageMonths <-
(currentMonth - month)
End If
Return age in months ((ageYears*12)
+ ageMonths)
END
Python Program:
from datetime import datetime
def calculateAge(month, year):
""" Calculates age in number of months """
# Current month
currentMonth = datetime.now().month
# Current year
currentYear = datetime.now().year
# Age in years
ageYears = currentYear - year;
# Age in months
if currentMonth < month:
# Finding in months
ageMonths = 12 - (month -
currentMonth)
# Finding in years
ageYears = ageYears - 1;
else:
# Finding in months
ageMonths = currentMonth -
month
# Returning age in
months
return ((ageYears*12) + ageMonths)
def main():
""" Program that reads month and year and calculates
age """
# Reading birth month
birthMonth = int(input("\n Enter birth month:
"));
# Reading year
birthYear = int(input("\n Enter birth year: "));
# Finding age
ageInMonths = calculateAge(birthMonth,
birthYear)
# Age in years and months
ageYears = int(ageInMonths / 12);
ageMonths = ageInMonths % 12;
# Printing age
print("\n\n Age: " + str(ageYears) + " years, " +
str(ageMonths) + " months. \n\n");
# Calling main function
main()
I need to Create the flowchart and pseudocode for a program that accepts a user’s birth...
you will create flowchart using Flowgorithm and Pseudocode for the following program example: Pet Care is a doggy day care that would like you to create a program that accepts the dog owner's name pet's name, breed, age and weight of the dog. The program should allow the user to enter this data until a sentinel value is reached. Then it will display the dog's name if the dog weighs less than 20 pounds or more than 100 pounds (be...
a. Create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. Create a separate method to do the calculation and return the result to be displayed. b. Modify the program in Exercise 3a so that the main program prompts the user for the amount of money and passes it to the interest-calculating method. c. Modify the program in Exercise 3b so...
Pseudocode and Flowchart: Program that stops production whenever there is a run of four consecutive pills that have a content of Ibuprofen above, or four consecutive pills with a level below 129. Also use these two modules in your code: machineOFF()is a module that turns off the machine when is executed. getIbuprofen()is a module that returns the value of Ibuprofen from the current pill or 0 if this is the last pill. Please make sure to use the following additional...
Flowchart for Python program: Design and create a program for the ULM Coffee Shop to provide some customer market research data. When a customer places an order, a clerk asks for the customer’s zip code and age. The clerk enters that data as well as the number of items the customer orders. The program operates continuously until the clerk enters a 0 for zip code at the end of the day. When the clerk enters an invalid zip code (more...
Python
In this assignment you are asked to enhance the #3 to define a class to model the characteristics of a generic employee. The class is part of a slightly larger program that incl create some employee objects and test its methods. The name of the class is Employee' and includes the following methods and attributes: n program created in Lab udes code to use the class to Method Name Input/ Attributes Output/ Returns Purpose Constructor sets initial values See...
In this module you learned about arrays. You also began learning about implementing arrays and how they can help organize the data in a program. The magic ball eight was created in the 50's and was produced by mattel. Eight Ball is a toy and is just a game. The magic 8 ball answers your yes/no questions. You will be creating a version of the Magic 8 Ball game. You can use whats inside the attached file to build your...
I need help with a JAVA program, In the program we need to create the next method. Method: End Salary This method receives the income, the benefits of a employee and a cap. Calculate and return the final income after taxes according to the following: Case 1: If the sum of income and benefits is greater than or equal to the cap, then 35% of taxes on accrued income will be paid (income + benefits) Case 2: If the sum...
PYTHON*************** Create a Person Class that: Accepts First Name, Last Name, Age, and Gender Has a method that adds all persons Validate all input, not left empty for First Name, Last Name, Gender and numeric for age and throw an exception if it does not validate within the class. Create a Student Class that: Inherits the Person Class Accepts GPA Validate GPA (>= 0 and <= 4.0) and throw exception if it does not validate within the class. Has methods...
I need help creating program for the Test_Bisection pseudocode.
I need to find a root for each function f and g and get the output
below.
Pseudocode Now let's construct pseudocode to carry out this procedure. We shall not try to create a piece of high-quality software with many "bells and whistles,” but we write the pseudocode in the form of a procedure for general use. This allows the reader an opportunity to review how a main program and one...
I need a c++ code please. 32. Program. Write a program that creates an integer constant called SIZE and initialize to the size of the array you will be creating. Use this constant throughout your functions you will implement for the next parts and your main program. Also, in your main program create an integer array called numbers and initialize it with the following values (Please see demo program below): 68, 100, 43, 58, 76, 72, 46, 55, 92, 94,...