0% found this document useful (0 votes)
8 views10 pages

Alvin 033352

Alhit tyi

Uploaded by

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

Alvin 033352

Alhit tyi

Uploaded by

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

FINAL PROJECT

CC102

SUBMITTED BY:JANROEL ALVIN R. FRANCISCO

SUBMITTED TO:DENNIS G. CORLET


SIMPLE BANKING SYSTEM
CODE

#include <stdio.h>

int main() {
char name[50];
float balance;
int choice;

// User Registration
printf("Welcome to the Simple Banking System!\n");
printf("Enter your name: ");
scanf("%s", name);
printf("Enter your initial balance: ");
scanf("%f", &balance);

// Main Menu Loop


do {
printf("\nMenu:\n");
printf("1. Deposit\n");
printf("2. Withdraw\n");
printf("3. Check Balance\n");
printf("4. Calculate Interest\n");
printf("5. Exit\n");
printf("Enter your choice (1-5): ");
scanf("%d", &choice);

switch (choice) {
case 1: { // Deposit
float depositAmount;
printf("Enter deposit amount: ");
scanf("%f", &depositAmount);
if (depositAmount > 0) {
balance += depositAmount;
printf("Deposit successful. New balance: %.2f\n", balance);
} else {
printf("Invalid deposit amount.\n");
}
break;
}
case 2: { // Withdraw
float withdrawAmount;
printf("Enter withdrawal amount: ");
scanf("%f", &withdrawAmount);
if (withdrawAmount > 0 && withdrawAmount <= balance) {
balance -= withdrawAmount;
printf("Withdrawal successful. New balance: %.2f\n", balance);
} else {
printf("Insufficient balance or invalid amount.\n");
}
break;
}
case 3: // Check Balance
printf("Your balance is: %.2f\n", balance);
break;
case 4: { // Calculate Interest (Simple Interest)
float interestRate = 0.05; // 5% annual interest rate
float interest = balance * interestRate;
printf("Interest earned this year: %.2f\n", interest);
break;
}
case 5: // Exit
printf("Thank you for using the banking system. Paalam, Janroel!\n");
break;
default:
printf("Invalid choice. Please try again.\n");
}
} while (choice != 5);

return 0;

}
Welcome to the Simple Banking System JANROEL!
Enter your name: JANROEL
Enter your initial balance: 500

Menu:
1. Deposit
2. Withdraw
3. Check Balance
4. Calculate Interest
5. Exit
Enter your choice (1-5): 1
Enter deposit amount: 500
Deposit successful. New balance: 1000.00

Menu:
1. Deposit
2. Withdraw
3. Check Balance
4. Calculate Interest
5. Exit
Enter your choice (1-5): 2
Enter withdrawal amount: 500
Withdrawal successful. New balance: 500.00

Menu:
1. Deposit
2. Withdraw
3. Check Balance
4. Calculate Interest
5. Exit
Enter your choice (1-5): 3
Your balance is: 500.00

Menu:
1. Deposit
2. Withdraw
3. Check Balance
4. Calculate Interest
5. Exit
Enter your choice (1-5): 4
Interest earned this year: 25.00

Menu:
1. Deposit
2. Withdraw
3. Check Balance
4. Calculate Interest
5. Exit
Enter your choice (1-5): 5
Thank you for using the banking system. Paalam, JANROEL!
FLOWCHART
STUDENT MANAGEMENT
SYSTEM

CODE

#include <stdio.h>

int main() {
// declare variables to store student information
char studentName[50];
int studentID;
int mathGrade;
int scienceGrade;
int englishGrade;
int choice;
int inputID;

printf("Welcome to the Student Management System!\n");

// menu loop
do {
printf("\nMenu:\n");
printf("1. Add Student Record\n");
printf("2. Display Student Record\n");
printf("3. Calculate Grade Average\n");
printf("4. Exit\n");
printf("Choose an option: ");
scanf("%d", &choice);

switch(choice) {
case 1:
// add student record
printf("Enter student name: ");
scanf("%s", studentName);

printf("Enter student ID: ");


scanf("%d", &studentID);

printf("Enter Math grade: ");


scanf("%d", &mathGrade);

printf("Enter Science grade: ");


scanf("%d", &scienceGrade);

printf("Enter English grade: ");


scanf("%d", &englishGrade);

printf("Student record added successfully!\n");


break;

case 2:
// display student record
printf("Student Record:\n");
printf("ID: %d, Name: %s, Math: %d, Science: %d, English: %d\n",
studentID, studentName, mathGrade, scienceGrade, englishGrade);
break;

case 3:
// calculate grade average by student ID
printf("Enter student ID to calculate grade average: ");
scanf("%d", &inputID);

if(inputID == studentID) {
float average = (mathGrade + scienceGrade + englishGrade) / 3.0;
printf("Average grade for student ID %d (%s): %.2f\n", studentID, studentName, average);
} else {
printf("Student with ID %d not found.\n", inputID);
}
break;

case 4:
printf("Thank you for using the Student Management System. Keep safe always goodbye!\n");
break;

default:
printf("Invalid choice! Please select a valid option.\n");
}
} while(choice != 4);

return 0;
}

Welcome to the Student Management System!

Menu:
1. Add Student Record
2. Display Student Record
3. Calculate Grade Average
4. Exit
Choose an option: 1
Enter student name: Janroel
Enter student ID: 123
Enter Math grade: 90
Enter Science grade: 92
Enter English grade: 93
Student record added successfully!

Menu:
1. Add Student Record
2. Display Student Record
3. Calculate Grade Average
4. Exit
Choose an option: 2
Student Record:
ID: 123, Name: Janroel, Math: 90, Science: 92, English: 93

Menu:
1. Add Student Record
2. Display Student Record
3. Calculate Grade Average
4. Exit
Choose an option: 3
Enter student ID to calculate grade average: 123
Average grade for student ID 123 (Janroel): 91.67

Menu:
1. Add Student Record
2. Display Student Record
3. Calculate Grade Average
4. Exit
Choose an option: 4
Thank you for using the Student Management System. Keep safe always
goodbye!

FLOWCHART
START

STUDENTS
INFORMATION

MENU

ADD STUDENT CALCULATE


RECORD DISPLAY STUDENT
GRADE AVERAGE
RECORD

EXIT

END

You might also like