Age Calculator Project
Prompt
Create a complete Age Calculator web application using HTML, CSS, and JavaScript. Your application should have a user-friendly interface where users can input their birth date (day, month, and year). Upon submission, the app will calculate and display the exact age in years, months, and days from the birth date to the current date. Ensure the interface is clean and responsive with appropriate styling. Handle edge cases such as invalid dates and future birth dates by providing clear error messages. # Steps - Design an HTML form to input day, month, and year. - Style the form and output area using CSS to create an attractive, clear layout. - Use JavaScript to: - Validate the input date fields. - Calculate the age by comparing the input birth date to the current date. - Update the page dynamically with the calculated age or error messages. # Output Format Provide the full code including HTML, CSS, and JavaScript either within a single HTML file using embedded CSS and JS, or as separate files with clear indications. Include comments in the code to explain key parts. # Examples Input: - Birth Date: 15, 8, 1990 Output: - Age: 33 years, 10 months, 21 days (example, depending on current date) # Notes - Assume the current date is the system's current date from JavaScript. - Ensure accessibility and responsive design for different screen sizes. - Provide clear user feedback for invalid inputs or future dates.
Related Coding Prompts
Write Code
As a seasoned programmer, your task is to write code in [programming language] to [perform action]. The code should be efficient, well-structured, and optimized for performance. Make sure to follow best practices and industry standards while implementing the necessary algorithms and logic to achieve the desired functionality. Test the code thoroughly to ensure it functions as intended and meets all requirements. Additionally, document the code properly for future reference and maintenance.
Debug Code
Act as a seasoned programmer with over 20 years of commercial experience. Analyze the provided [piece of code] that is causing a specific [error]. Your task involves diagnosing the root cause of the error, understanding the context and functionality intended by the code, and proposing a solution to fix the issue. Your analysis should include a step-by-step walkthrough of the code, identification of any bugs or logical mistakes, and a detailed explanation of how to resolve them. Additionally, suggest any improvements or optimizations to enhance the performance, readability, or maintainability of the code based on your extensive experience. Ensure that your solution adheres to best practices in software development and is compatible with the current development environment where the code is being executed.
Do Code Review
As a seasoned programmer with over 20 years of commercial experience, your task is to perform a comprehensive code review on the provided [piece of code]. Your review should meticulously evaluate the code's efficiency, readability, and maintainability. You are expected to identify any potential bugs, security vulnerabilities, or performance issues and suggest specific improvements or optimizations. Additionally, assess the code's adherence to industry standards and best practices. Your feedback should be constructive and detailed, offering clear explanations and recommendations for changes. Where applicable, provide examples or references to support your suggestions. Your goal is to ensure that the code not only functions as intended but also meets high standards of quality and can be easily managed and scaled in the future. This review is an opportunity to mentor and guide less experienced developers, so your insights should be both educational and actionable.