Lab03 OOP

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

OBJECT ORIENTED PROGRAMMING

(3+1 Credit Hours)

CSL-210

DEPARTMENT OF COMPUTER SCIENCE

BAHRIA UNIVERSITY, KARACHI, PAKISTAN


OBJECT ORIENTED PROGRAMMING
CSL-210
(Spring-2024)

Student Name: Ayesha Tahir

Registration Number: 02-235232-020

Class & Section: BS(IT)2-A


Exercise 1: Personalized Folder Name
Assume that we have a file naming system where users can personalize their folder names
based on their preferences, adding a creative element to the file management experience.
Users can create a unique folder name by combining the first two letters of their favorite
color, the first two letters of the document type, and a random two-digit number. Design a
Java program that takes user input for their favorite color and document type, then generates
a unique folder name following the specified criteria. Ensure that the folder name is in
lowercase.

SOURCE CODE:
OUTPUT:

Exercise 2: Password Validation


Assume that you are designing a password validation system for a secure application. As
part of the password strength requirements, users are required to create a palindrome
password. A palindrome password is one that reads the same backward as forward. Design
a Java program that prompts users to enter a password and checks whether the password is
a palindrome or not.

SOURCE CODE:
OUTPUT:

Exercise 3: Plant Growth Calculator


You are required to design a program for a gardening club that helps members keep track
of the growth of their plants. The program needs to perform various tasks to analyze the
plant's growth data for every 10 days. Design a Java program with the following tasks:
1. Average Growth Calculation: Store the growth height for each day. Compute and
display the average growth of plant.
Maximum Growth Identification: Search and display the day with the maximum
growth in height. (For e.g. on Day 5 the growth is maximum)

SOURCE CODE:
OUTPUT:
Exercise 4: Seat Reservation
You are tasked with designing a program for a theater seat arrangement that allows
customers to reserve seats based on their gender (Male-M or Female-F). The program
should efficiently manage seat bookings, provide information on the number of male and
female customers seated, and display the count of empty seats. Design a menu driven Java
program with the following features:
1. Seat Reservation
2. Count of female and male audience
3. Count of empty seats

SOURCE CODE:
OUTPUT:
Exercise 5: Paragraph Analyzer
In the development of an essay application, a crucial feature is required to analyze
paragraphs. Write a java program that takes a paragraph as input. Categorizes the paragraph
into different categories based on its word count. The categorization will help identify
whether the paragraph is short, medium, or long as shown in table below. Ensure that the
application displays paragraph analysis report including the total word count and the number
of lines present in the paragraph alongside the category assigned.

SOURCE CODE:
OUTPUT:

You might also like