Description
Part A: This question is to be submitted to the instructor in the form of a Word (or Open Office) document containing the Java code and appropriate screen capture(s) of the output. The file name must be in the form ASSIGN4A_YourName where ‘YourName’ is your last name followed by your first name with no space. Upload the file to CMS.
1) [10 marks] A license plate is comprised of four capital letters, a space and then three numbers OR three capital letters and four numbers. Write a program that generates a new license plate every time it is executed. Demonstrate the program by screen captures of the program running five times where at least one version of each type is provided.
A randomly generated license plate: MACJ 321 A randomly generated license plate: IDK 2648
2) [15 marks] Write a program that prompt the user to enter a Social Insurance Number in the format DDD-DDD-DDD, where D is a digit. Your program should check if the input is valid in terms of form. Additionally, the program should determine if the number is valid using the validation formula provided at: https://www.straightlineinternational.com/docs/vaildating_canadian_sin.pdf
Enter a SIN: 43-1234-234 43-1234-234 is invalid. Format error.
Enter a SIN: 431-234-236 431-234-236 is valid.
Enter a SIN: 283-429-638 431-234-236 is invalid. The number is invalid.
Demonstrate the program works for the three numbers above plus 7834-234-56, 146-328-629, and 645-218-793 (total of 6 screen shots)
COSC 1046 (F17) – Introduction to Computer Science
Part B: Write code and test the solutions for the following problems from the textbook. Submit the .java files for each question to CMS. The answers are due on October 21st and the programs are to be demonstrated to the Teaching Assistant (Tim) by October 27th. He will ask questions to make sure you understand the material. (HINT: If you demonstrate your programs before the due date, Tim can give you an opportunity to fix errors and redemonstrate).
1) [15 marks] Write a program that prompts the user to enter an integer between 0 and 255 and displays it as a two-digit hex number. Hint: use modulus and integer division to isolate the two digits. (You cannot use the Integer.valueOf() method.)
Here are some sample runs: Enter a decimal value (0 to 255): 124 [Enter] The hex value is 7C
Enter a decimal value (0 to 255): 13 [Enter] The hex value is 0D
Enter a decimal value (0 to 255): 165 [Enter] The hex value is A5
Enter a decimal value (0 to 255): 210 [Enter] The hex value is D2
Enter a decimal value (0 to 255): 23 [Enter] The hex value is 17
Enter a decimal value (0 to 255): 255 [Enter] The hex value is FF
[10 marks] Problem 4.17, page 154 Your program should allow the user to enter the full name of the month in any mix of upper and lower case – but the program will only use the first three letters of the entry. For example: February, feb, and Feb should all be recognized as the same month.