Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C++ without using a string library and please follow the instructions carefully 4. (20 marks) Write a program that checks the

Write a program in C++ without using a string library and please follow the instructions carefullyimage text in transcribedimage text in transcribedimage text in transcribed

4. (20 marks) Write a program that checks the validity of user identifiers. Assume your identifier is 3 entries long. Ignore all keywords. As shown in the following: Enter 3-character identifier:Y@k Y@k is an invalid identifier. Check char 2. Enter 3-character identifier:Abc Abc is a valid identifier Enter 3-character identifier:9_f 9_f is an invalid identifier. Check char 1 (25 marks) Write a code in C++ to derive the permanent code from your age and date of birth. The Permanent Code System (PCS) should work as follows: Welcome to the Permanent Code System (PCS) Enter your date of birth (yyyy mm dd) : 20000430 Enter the current date (yyyy mm dd) : 20230125 Your age is 22y8m25d Your Permanent code: VY000430 Welcome to the Permanent Code System (PCS) Enter your date of birth (yyyy mm dd) : 19901203 Enter the current date (yyyy mm dd) : 20230125 Your age is 32y 1m 22d Your Permanent code: FV901203 Conditions: - Follow the format shown in all relevant figures. - The permanent code consists of two characters and six numbers, e.g. FV901203. - The first two numbers represent the last two digits of your year of birth (e.g. If you were born in 1990, use 90 in your permanent code.) - The second two numbers represent your month of birth (e.g. if you were born in Dec use 12 in permanent code). - The third two numbers represent your day of birth (For example, if you were born on the 3rd of the month, use 03 in the permanent code). - After calculating the age, convert the number of years to a capital letter. Assuming that 1 is ' A ', 2 is ' B ', and 26 is ' Z '. In case your age is above 26 warp around starting from 1 (e.g. your age is 32 becomes 6 and it is ' F '. This character is the first letter in the permanent code. - Similarly, you can calculate the second letter but using the days of your age. - You are not allowed to use any header files except . Limitations: - Assume all months are 30 days. - Assume your age doesn't exceed 99 years@). - Assume that the user will enter the correct information so that the code does not check the correctness of the data

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions