DHA SUFFA UNIVERSITY
Department of Computer Science
CS-1001 Programming Fundamentals
Spring 2025
Assignment 1 Points: 20
Instructions:
1. Write steps in simple English to solve problems (1-2).
2. Draw Flowchart and write pseudo code for problems (3).
3. Use any Word processing software, e.g, use MS Word. Font size 12. No handwritten solution
or its snaps.
4. If you will not follow these instructions properly your assignment will not be graded.
Problem 1: Fake coin [5 Points]
There are 12 identical-looking coins. One of these coins is counterfeit and is known to
be lighter than the genuine coins. Ahmed has to identify the fake coin using mechanical
balance, but unfortunately he doesn’t have a mechanical balance. He go to market and
ask a shopkeeper to use his mechanical balance, shopkeeper allow him to use the
mechanical balance but each time he will charge him Rs 100. Now guide Ahmed step
by step to use the minimum number of mechanical balance and identify the fake coin.
Problem 2: Area of Circle [5 Points]
Mr. Gardener is renovating his garden and want to paint a Sun on one of his wall. He
called Mr. Painter to paint a circle on wall. Mr. Painter first needs to calculate the area
so he can bring then required amount of paint. Help Mr. Painter to find area by asking
largest distance (diameter) across the circle. (Hint: Area of circle = 2πr2)
Problem 3: Age Calculator [5 Points]
Generate an age calculator, which takes the current year, and year of birth as input and
output your age in years, months and days.
Example
Input:
Current Year: 2020
Year of Birth: 2000
Output:
Years: 20
Months: 240
Days: 7300
Problem 4:Library Book Fine System [5 Points]
A public library charges a fine for late return of books. The fine amount depends on the
type of user and number of days the book is returned late.
● For Students:
○ 1–5 days late: Rs 2/day
○ 6–10 days late: Rs 5/day
○ Beyond 10 days: Rs 10/day
● For Faculty:
○ 1–7 days late: Rs 1/day
○ 8–15 days late: Rs 3/day
○ Beyond 15 days: Rs 5/day
● If the book is returned after 30 days, library access is blocked.
● If returned on or before the due date, display “No Fine”.
Write pseudocode to:
● Ask the user
○ Are they a Student or Faculty?
○ How many days late is the return?
● Calculate and show fine
● Display “Library Access Blocked” if applicable