Intro - To - Programming - Assignment #2 - Spring - 2024
Intro - To - Programming - Assignment #2 - Spring - 2024
Assignment #2
Student Name
Student ID
25 March 2024 @ 11:59 PM Due Date
10
Out of (5)
Question 1: (CLO#3,4) (10 marks)
Write a Java program that performs the following tasks:
1. Read the student's full name with spaces. For example, if the full name is "Mohammad
Sharif", the program should read it with spaces separating the first name, (Middle name)
and family name.
2. Convert each character of the entered name to its ASCII code(spaces among names have to
be excluded).
3. Convert each ASCII code to its binary representation.
4. If the ASCII code length is less than 8 bits, add leading zeros to make the total length 8.
For example, for the character 'M', the ASCII code is 77, and its binary representation is
1001101. In this case, the binary length is 7 digits. Therefore, to ensure the length is 8 bits,
we add a zero at the beginning. The new ASCII representation for 'M' is 01001101.
Example :
The program should provide the output in the following format:
Please enter your full name with spaces: Mohammad Sharif
Best Wishes