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

HAMRO CALENDER USING C PROGRAMMING 2[3]

The project report details the development of a Nepali calendar application using C programming, designed to manage events specific to the Nepali calendar system. It emphasizes user-friendly features, file handling for persistent storage, and modular programming techniques to enhance functionality. The report also outlines the project's objectives, requirements, and potential future enhancements to improve the application.

Uploaded by

surajyadab989
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

HAMRO CALENDER USING C PROGRAMMING 2[3]

The project report details the development of a Nepali calendar application using C programming, designed to manage events specific to the Nepali calendar system. It emphasizes user-friendly features, file handling for persistent storage, and modular programming techniques to enhance functionality. The report also outlines the project's objectives, requirements, and potential future enhancements to improve the application.

Uploaded by

surajyadab989
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

TRIBHUWAN UNIVERSITY

INSTITUTE OF ENGINEERING
PULCHOWK CAMPUS

A PROJECT REPORT ON
HAMRO CALENDER USING C PROGRAMMING

SUMBITTED BY SUMBITTED TO
SURAJ KUMAR YADAV(90)
SOVIT KHAREL(81) TO PRAKASH SIR
ROHAN JOSHI()
PRAVEEN PRASAD KHUSHWAHA (61)
ABSTRACT
This project introduces a Nepali calendar application designed using the C programming
language, tailored for the Nepali months such as Baisakh, Jestha, and beyond. The program
enables users to manage and store events effectively with a user-friendly interface. Leveraging
file handling, the application provides persistent storage for event data, ensuring users can
retrieve and view their saved events effortlessly. The code incorporates modular programming
techniques, utilizing arrays, conditional statements, and file operations to enhance functionality.
By demonstrating the practical implementation of core programming concepts, this project
serves as both a functional tool and a learning resource for developers exploring structured
programming.
ACKNOWLEDGMENT
I express my deepest gratitude to everyone who supported me in the creation of this project. I
am particularly thankful to my mentors and peers, whose guidance and feedback played a critical
role in shaping the functionality of this calendar application. I also acknowledge the invaluable
contribution of online and offline resources, which served as reference points for understanding
file handling and program design. Finally, I extend my heartfelt thanks to the wider programming
community for fostering an environment of curiosity and collaboration that inspired this project.
Introduction
A calendar is an essential tool in managing daily life, events, and schedules. With the increasing shift toward digitization, creating a
calendar application tailored to specific cultural and regional requirements can help bridge the gap between technology and tradition.
This project focuses on developing a Nepali calendar application using the C programming language, incorporating the unique months
of the Nepali calendar (e.g., Baisakh, Jestha). By integrating key programming concepts like file handling and modular design, the
application provides an efficient solution for event management while respecting cultural significance.
Project Statement
The project aims to design and implement a Nepali calendar application in C language that allows users to manage events efficiently,
offering functionalities such as adding, storing, and viewing events persistently using file handling techniques.
Need for the Project
1.Cultural Significance: While general calendars are widely available, few cater to the unique Nepali calendar system, including its
distinct months and cultural context.
2.Personalized Event Management: This project provides users with the ability to store and retrieve events specific to their schedules,
ensuring a more user-centric approach.
3.Educational Purpose: The project demonstrates the practical application of C programming concepts, offering a learning opportunity
for developers to explore file handling and program design.
4.Preserving Data: With file-based storage, the application ensures that event data is not lost upon exiting the program, enhancing
reliability and usability.
Objective
The primary objectives of this project are:
5.To design an interactive application that supports the Nepali calendar system.
6.To implement file handling for persistent storage of user-defined events.
7.To provide a simple, user-friendly interface for adding, viewing, and managing calendar events.
Background Theory
The calendar project is a practical application of C programming principles, aimed at managing
and storing events specific to the Nepali calendar. It integrates fundamental and advanced
concepts of programming, including file handling, arrays, and modular design, demonstrating the
versatility of C in solving real-world problems. By leveraging structured programming techniques,
the project enables a streamlined user experience for input, storage, and retrieval of calendar
events.
This project emphasizes the importance of persistent data storage through file handling, which
ensures data continuity even when the application is closed. Additionally, arrays and pointers are
utilized for efficient data management, while formatted input/output functions make the
application user-friendly.
Key Concepts Used in the Program
1.File Handling:
•Ensures persistent storage of event data.
•Operations such as reading (fgets, fscanf), writing (fprintf), and appending data (a+ mode) are used.
2.Structured Programming:
•Functions like add Event and view Events modularize the application, improving code readability and maintainability.
3.Arrays:
•Used to store Nepali months as strings (nepali_months[]).
•Provides easy access to month names using an index-based approach.
4.Conditional Statements:
•Validates user input for dates and months (e.g., checking if the month is within the range of 1 to 12).
5.Formatted Input and Output:
•fprintf and fgets allow easy formatting of data for storage and display.
•String manipulation and formatting ensure user-friendly interaction.
6.String Handling:
•Functions like fgets, strcspn, and scanf are utilized to process user inputs and parse stored data.
7.ANSI Escape Codes (optional):
•Adds color formatting for better user experience (e.g., CYAN_TEXT_BLUE_BG and RESET).

Key Statements Used in the Program


8.File Handling Statements:
•FILE *file = fopen("calendar_events.txt", "a+");: Opens the file for appending and reading.
•fprintf(file, "%02d %02d %s\n", month, day, event);: Writes formatted event data to the file.
•rewind(file);: Resets the file pointer to the beginning of the file for reading.
REQUIREMENTS
Case Requirement
This project addresses the need for a digital Nepali Calendar that allows users to store and view events specific to the
Nepali context, such as festivals and personal milestones.
Use Case:
•Actors: End-user (individuals who input and retrieve events), System (calendar program).
•Scenario: A user wants to:
• Add an event with a specific day and month from the Nepali calendar.
• View all stored events listed by date and month.
•Triggers: User selects "Add Event" or "View Events" from the menu.
Business Requirements
1.Support Nepali Calendar Context:
1. Incorporate Nepali months and support the unique cultural relevance.
2.Event Management:
1. Allow users to add, view, edit, or delete events associated with specific dates.
3.User-friendly Interface:
1. Provide an intuitive menu system to guide users through available functionalities.
4.Scalability:
1. Accommodate up to 100 events initially with the ability to expand storage if needed in the future.
5.Localization:
System Requirements
Functional Requirements:
1.File Handling:
•Use a text file (calendar_events.txt) to store and retrieve event data persistently.
•Support reading and appending operations without overwriting existing data.
2.Input Validation:
•Verify valid months (1-12) and days (based on Nepali month lengths).
•Ensure event descriptions are concise and error-free.
3.Event Listing:
•Display events in a sorted and readable format with day and month information.
Non-Functional Requirements:
4.Performance:
•Load, display, or store events with minimal latency.
2.Reliability:
•Ensure data integrity during write operations to avoid file corruption.
3.Portability:
•Run seamlessly on any C programming-compatible environment.

Example Scenarios (Use Cases):


4.A student wishes to store Nepali New Year events in Baisakh.
They open the program, choose "Add Event," input the date and description, and save successfully.
2.A user wants to view upcoming events in their calendar, selects "View Events," and sees a list of all stored occasions,
formatted by Nepali months.
1.Approach of the Project

The project aims to create a text-based Nepali Calendar system that allows users to add and view events efficiently. It will involve:
•Input Handling: Accept user inputs for the date (day, month) and event description.
•Storage Management: Use a file (calendar_events.txt) to store and retrieve data persistently.
•Display Mechanism: List events in a clear and user-friendly format, using Nepali month names.

2. System Design

System Architecture:
The system will follow a modular design for simplicity and scalability:

1.Input Module:
•Handles user input validation (e.g., valid month, day ranges).
•Collects event details from the user.
2.Processing Module:
•Converts raw input into a structured format for storage in the file.
•Reads and parses data from the file for display.
3.Output Module:
•Displays stored events with proper formatting (e.g., date and month name).
4.File Handling Module:
•Manages reading and writing operations on the text file.
3. Constraints
Technical Constraints:
1.File Size Limit: The system supports up to 100 events (adjustable).
2.Input Length: Event descriptions must not exceed 100 characters.
3.Day Validation: Days must respect the Nepali calendar (e.g., Falgun can have 30 or 31 days).
4.Sequential Access: Events are stored in a plain text file, meaning no direct access to specific
events without reading the entire file.
User Constraints:
5.Users must manually provide valid input (month and day) when adding events.
6.No automated handling for leap years or variable day counts in months.
Future Enhancements:
•Add search functionality for specific events by month or keyword.
•Implement edit and delete features for event management.
•Develop a graphical user interface (GUI) for better user experience.
Algorithm for adding Events
1.Start
2. Prompt user to enter:
a. Month (Validate: 1 ≤ month ≤ 12)
b. Day (Validate: 1 ≤ day ≤ max_days_in_month[month-1])
c. Event Description
3. Open "calendar_events.txt" in append mode.
4. Write data in the format: <Month> <Day> <Event Description>
5. Close the file.
6. Display a success message.
7. End
Algorithm for viewing Events
1. Start
2. Open "calendar_events.txt" in read mode.
3. If the file is empty:
a. Display "No events saved."
b. Exit the view function.
4. For each line in the file:
a. Parse line into <Month>, <Day>, and <Event Description>
b. Format the output as: "<Day> <Nepali Month Name>: <Event>"
5. Display all parsed events.
6. Close the file.
7. End
SOURCE CODE
#include <stdio.h>
#include <string.h>

#define MAX_EVENTS 100


#define EVENT_FILE "calendar_events.txt"

const char *english_months[] = {


"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};

typedef struct {
int day;
int month;
char event[100];
} Event;

void addEvent(FILE *file) {


int day, month;
char event[100];
printf("\nEnter month (1 for January, 2 for February, etc.): ");
scanf("%d", &month);
if (month < 1 || month > 12) {
printf("Invalid month! Please try again.\n");
return;
}

printf("Enter day: ");


scanf("%d", &day);
printf("Enter event description: ");
getchar(); // Clear newline character left by scanf
fgets(event, sizeof(event), stdin);
event[strcspn(event, "\n")] = 0; // Remove newline character from input

fprintf(file, "%02d %02d %s\n", month, day, event);


printf("Event added successfully!\n");
}

void viewEvents(FILE *file) {


char line[200];
int month, day;
char event[100];
rewind(file); // Move the pointer to the beginning of the file
printf("\nSaved Events:\n");
while (fgets(line, sizeof(line), file)) {
scanf(line, "%d %d %[^\n]", &month, &day, event);
printf("%02d %s: %s\n", day, nepali_months[month - 1], event);
}
}

int main() {
FILE *file = fopen(EVENT_FILE, "a+");
if (file == NULL) {
printf("Error opening file!\n");
return 1;
}

int choice;
do {
printf("\n English Calendar Menu:\n");
printf("1. Add Event\n");
printf("2. View Events\n");
printf("3. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
addEvent(file);
break;
case 2:
viewEvents(file);
break;
case 3:
printf("Exiting Calendar...\n");
break;
default:
printf("Invalid choice! Try again.\n");
}
} while (choice != 3);

fclose(file);
return 0;
}
OUTPUT
Upon launching, the program displays a menu with three options:
Nepali Calendar Menu:
1. Add Event
2. View Events
3. Exit
Enter your choice:
If you choose option 1 (Add Event):
The program asks for the month (1 for Baisakh, 2 for Jestha, etc.).It then prompts you to enter
the day and an event description. Upon successful entry, it stores the data in the file
calendar_events.txt and confirms:
Event added successfully!
•If you choose option 2 (View Events):
•The program reads the calendar_events.txt file and displays
the saved events in the following format:
Saved Events: 05 Baisakh: Birthday Party 10 Jestha: Exam Date
Each event is listed by the day, Nepali month, and its description.

•If you choose option 3 (Exit):


•The program exits gracefully with a message:
Exiting Calendar...

•If you enter an invalid choice (e.g., 4):


•The program displays an error message and loops back to the menu:
Invalid choice! Try again.
DISCUSSIONS
Problems Encountered
1.Input Handling:
•Mismanagement of newline characters caused issues with the event description input initially
(but was corrected with getchar() and fgets()).
2.Validation:
•No validation was implemented for the day field to account for the varying number of days
in different Nepali months.
3.File Overwriting Issues:
•There may be complications if the file is corrupted or edited manually outside the program.
Limitations
4.Sorting of Events:
1. Events are not sorted by date, which could cause inconvenience for users managing multiple events.
5.Search Functionality:
1. There’s no feature to search for events based on keywords, dates, or months
Conclusion
This program is an excellent foundation for building a culturally relevant and practical calendar
application. While functional and effective in its current state, addressing the limitations and
implementing further enhancements will make it a more robust and feature-rich tool. Keep up
the great work refining and expanding this project! If you’d like help with any specific
improvement, I’d be glad to collaborate.

You might also like