We read your photo as:

Implement a program to ask for the user's name and his/her age now. The program should then welcome the user to practical world (with the name he/she supplied), his/her age now, the year he/she was born and his/her age in five years' time.

Computer Science

ScanSolve AI Answer

This exercise requires you to implement a program based on the given specifications and then perform several steps related to its development and testing.

The program should:

  • Prompt the user for their name and current age.
  • Display a welcome message including their name.
  • Display their current age.
  • Calculate and display their birth year using the formula: yearOfBirth = currentYear - age.
  • Calculate and display their age in five years' time.

Here's how to approach each part of :

a) Compile the program and note the number and types of errors you incur during first compilation of the program.
This step involves writing your program code and then using a compiler (e.g., javac for Java, gcc for C/C++, python interpreter for Python) to translate it into an executable form. You should record any syntax errors (e.g., missing semicolons, misspelled keywords) or semantic errors (e.g., type mismatches) that the compiler reports.

b) Write your report in your Lab Manual.
This is a documentation task. You should detail your program's design, the code you wrote, the compilation process, any errors encountered and how you resolved them, and the results of running the program.

c) Run the program for at least 3 times with different set of data.
After successfully compiling your program, execute it multiple times. For each run, provide different inputs for the user's name and age. This helps in testing the program's correctness and ensuring it handles various inputs as expected.

d) Find out how to get current year from the system date in the programming language you are using. Use the System date for your program.
You need to research and implement a way to programmatically obtain the current year from the operating system's date and time. Most programming languages have built-in libraries or functions for this (e.g., datetime module in Python, java.time.Year in Java, time.h in C). Integrate this functionality into your program to automatically get currentYear instead of hardcoding it.

e) Record the challenges you had and your observations.
Reflect on the entire process of developing, compiling, and running the program. Document any difficulties you faced, such as understanding specific language features, debugging logic errors, or integrating the system date functionality. Also, note any interesting observations about the program's behavior or the development process.

Was this helpful?

Still stuck on this one?

Ask a follow-up, and the answer starts from this question.

Got a different question?Ask your own question
Handwritten step-by-step solution preview

Handwritten Step-by-Step Solution

Get this as a handwritten image on WhatsApp — like a tutor wrote it for you.

Try on WhatsApp