0% found this document useful (0 votes)
97 views

Total Marks: 5 X 5 25: COMSATS University Islamabad Department of Computer Science

This document contains instructions for Assignment 2 for the Programming Fundamentals class. It provides 5 programming questions to answer in Java, with each question worth 5 marks for a total of 25 marks. The assignment is due on November 14, 2021. Students must submit their assignment in a Word document with their registration number as the file name. It must include the source code and output for each question. Plagiarism is not allowed and will result in zero marks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views

Total Marks: 5 X 5 25: COMSATS University Islamabad Department of Computer Science

This document contains instructions for Assignment 2 for the Programming Fundamentals class. It provides 5 programming questions to answer in Java, with each question worth 5 marks for a total of 25 marks. The assignment is due on November 14, 2021. Students must submit their assignment in a Word document with their registration number as the file name. It must include the source code and output for each question. Plagiarism is not allowed and will result in zero marks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COMSATS University Islamabad

Department of Computer Science


Programming Fundamentals (CSC103) – BSCS-2A & 2B
Class Assignment – 2 (CLO-3)

Due Date: November 14, 2021 (11:59 pm)

Total Marks: 5 x 5 = 25

Instructions
Answer to all questions must be submitted in MS Word.

Answer to all questions should begin on new page.

Assignment document must contain a title page showing Assignment-2, your name and
registration number.

Assignment document must also contain JAVA source code along with output.

Solution to JAVA Programming problems must be created in separate .java file (for each
question). For example, Question1.java

You must follow proper JAVA naming convention for identifiers and properly document your
source code

Combine all your work in one folder. The folder must contain .JAVA source files and a
.doc/.docx file.

Name of the Assignment document file should be your Registration Number. E.g.
FA21BCS01.docx

Submit your work via MS Teams

Plagiarism: Plagiarism is not allowed. If found plagiarized, zero marks will be awarded in the
assignment.
COMSATS University Islamabad
Department of Computer Science
Programming Fundamentals (CSC103) – BSCS-2A & 2B
Class Assignment – 2 (CLO-3)
Question – 1: ______
Write a program that prompts the user to enter a Social Security number in the format DDD-DD-
DDDD, where D is a digit. Your program should check whether the input is valid. Here are
sample runs:
Enter a SSN: 232-23-5435
232-23-5435 is a valid social security number
Enter a SSN: 23-23-5435
23-23-5435 is an invalid social security number

Question – 2: ______
Write a program that prompts the user to enter two strings and reports whether the second string
is a substring of the first string
Enter string s1: ABCD
Enter string s2: BC
BC is a substring of ABCD

Question – 3: ______
Assume a vehicle plate number consists of three uppercase letters followed by four digits. Write a
program to generate a plate number.

Question – 4: ______
Write a program that displays all the leap years, ten per line, from 101 to 2100, separated by
exactly one space. Also display the number of leap years in this period.

Question – 5: ______

Write a program that prompts the user to enter a decimal integer and displays its corresponding
binary value. Don’t use Java’s Integer.toBinaryString(int) in this program.

You might also like