15.13 Programming Assignment #12 Various websites like Wikipedia or IMDB list not just a person's birthdate...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
15.13 Programming Assignment #12 Various websites like Wikipedia or IMDB list not just a person's birthdate but also the person's current age. Given a person's birthdate and current date, output the person's age in years. Write a method that, given a person's birthdate and current date, returns the person's age in years. The custom is to round down. If the input is 71 2000 2 15 2015, the output is 14 (because the person hasn't yet reached their 15th birthday). A person less than 1 has age 0. Hints: Start by computing currAge just as the difference in years. Then, use an if-else statement to determine whether to decrement currAge. • One reason to decrement is if the current month is less than the birth month (no birthday yet this year). • Another reason to decrement is if the current month equals the birth month, but the current day is less than the birth day. 354538.2438654.qx3zqy7 LAB ACTIVITY 15.13.1: Programming Assignment #12 LabProgram.java 0/5 Load default template... 4 5 6 3 public class LabProgram { public static int getAge (int birthMonth, int birthDay, int birthYear, int currMonth, int currDay, int currYear) /* Type your code here. */ 7 8 } 9 10 11 12 13 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int birthMonth, birthDay, birthYear; int currMonth, currDay, currYear; 14 15 birth Month scnr.nextInt(); birthDay 16 currMonth scnr.nextInt(); currDay = 17 18 = = scnr.nextInt(); birth Year scnr.nextInt(); scnr.nextInt(); currYear = scnr.nextInt(); System.out.println(getAge (birth Month, birthDay, birthYear, currMonth, currDay, currYear)); 19 15.13 Programming Assignment #12 Various websites like Wikipedia or IMDB list not just a person's birthdate but also the person's current age. Given a person's birthdate and current date, output the person's age in years. Write a method that, given a person's birthdate and current date, returns the person's age in years. The custom is to round down. If the input is 71 2000 2 15 2015, the output is 14 (because the person hasn't yet reached their 15th birthday). A person less than 1 has age 0. Hints: Start by computing currAge just as the difference in years. Then, use an if-else statement to determine whether to decrement currAge. • One reason to decrement is if the current month is less than the birth month (no birthday yet this year). • Another reason to decrement is if the current month equals the birth month, but the current day is less than the birth day. 354538.2438654.qx3zqy7 LAB ACTIVITY 15.13.1: Programming Assignment #12 LabProgram.java 0/5 Load default template... 4 5 6 3 public class LabProgram { public static int getAge (int birthMonth, int birthDay, int birthYear, int currMonth, int currDay, int currYear) /* Type your code here. */ 7 8 } 9 10 11 12 13 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int birthMonth, birthDay, birthYear; int currMonth, currDay, currYear; 14 15 birth Month scnr.nextInt(); birthDay 16 currMonth scnr.nextInt(); currDay = 17 18 = = scnr.nextInt(); birth Year scnr.nextInt(); scnr.nextInt(); currYear = scnr.nextInt(); System.out.println(getAge (birth Month, birthDay, birthYear, currMonth, currDay, currYear)); 19
Expert Answer:
Answer rating: 100% (QA)
Steps Step 1 of 1 C program wih the function 1 include 2 using namespace std 3 4 int GetAge int birt... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
You have been asked for your advice in selecting a portfolio of assets and have been supplied with the following data. You have been told that you can create 2 portfoliosone consisting of assets A...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Discuss the concept of the Process Spectrum. Use examples where appropriate.
-
On July 25, 2011, the average price of a gallon of gasoline was $3.70. Just five years later the price of that same gallon of gas was $2.14. What was the rate of inflation (deflation) in the price of...
-
What is a multinomial experiment?
-
Consider a branching process for which the generator function for the branching probabilities is given by (a) What is the probability that an individual produces k offspring? (b) What is the average...
-
Comparative financial statement data of Hamden Optical Mart follow: Other information: 1. Market price of Hamden common stock: $102.17 at December 31, 2012, and $77.01 at December 31, 2011 2. Common...
-
The Upton Company's most recent dividend was$1.60.Its dividend growth rate is expected to be constant at 25% for 3years, after which dividends are expected to grow at a constant rate of 10% forever....
-
Grant Company purchased 80% of Lincoln Company stock for $650,000. At the time of the purchase, Lincoln Company had a book value was $480,000 with the excess being caused by a patent being...
-
DESCRIBE: Think about the key factors that caused problems at Wells Fargo. Describe at least two key factors. Make sure to elaborate on each factor. CONNECT: Make a connection between the problems...
-
Your IT team has been asked to access the risks of an application server upgrade project. Discuss the common sources of risk for this IT project and give suggestions for managing them. Explain why...
-
Many companies are addressing the needs of employees to balance work life and family life by offering a flexible schedule, job sharing, etc. What is the upside and downside for a company that offers...
-
Do you have design problems you need to tackle? Explain. A design problem are problems with no one ideal solution (in contrast to an engineering problem that would have one ideal solution) Do you...
-
Considering the overarching structure of the project management office (PMO), portfolios, programs, and projects, what are the dynamics of team formation for each of these areas? What external and...
-
Joe's BBQ Supply began operations in 2016 and adopted weighted-average pricing for its inventory. At the beginning of 2017, Joe's decided to switch to LIFO pricing for inventory. Because inventory...
-
In 1995 Miguel purchased a home for $130,000. In 2000 he sold it for $170,000 and immediately purchased another one for $180,000, which he sold in 2007 for $235,000. How much taxable capital gain, if...
-
Sherry rents her vacation home for 6 months and lives in it for 6 months during the year. Her gross rental income during the year is $4,000. Total real estate taxes for the home are $950, and...
-
In June of 2012, Maureen's house is vandalized during a long-term power failure after a hurricane hit the city. The president of the United States declares Maureen's city a disaster area as a result...
-
Amy is a calendar-year taxpayer reporting on the cash basis. Please indicate how she should treat the following items for 2012: a. She makes a deductible contribution to an IRA on April 15,...
-
What do you understand by a bank lending policy in the context of a monetary policy?
-
A columnist in the Wall Street Journal argues: Whether youre a borrower or a saver, what matters isnt the nominal interest rate but the real, post-inflation rate of return. Do you agree? Briefly...
-
What is the relationship between the MPC and the multiplier? Would a larger value for the MPC tend to increase or decrease the stability of the economy? Briefly explain.
Study smarter with the SolutionInn App