This project is a simple C-based program to calculate call costs based on call duration and the selected provider. It was developed as part of the Final Project for the Logic and Algorithm Practice course.
- Calculate call duration in seconds.
- Provide provider options (Telkomsel, Indosat, Tri).
- Calculate call costs based on the selected provider.
- Allow users to repeat the process or exit the program.
- Programming Language: C
- IDE: Code::Blocks
- Libraries:
stdio.h(Input/Output)stdlib.h(Conversion and comparison operations)
-
Input Call Duration:
The user is prompted to enter the start and end times of the call. The program calculates the call duration in seconds. -
Provider Selection:
The user can choose one of three available providers. Costs are calculated based on the selected provider. -
Menu Loop:
The user can return to the menu to calculate costs with different durations or providers, or exit the program.
-
Variable Declarations:
Variables such asjamA,menitA,jamB,menitBare used to store call times.
Thebiayavariable stores the cost per second for each provider. -
Calculation Logic:
Arithmetic operations are used to calculate the call duration.
Theswitch-casestructure is used to handle provider selection.
Ado-whileloop is implemented to allow users to repeat the process. -
Error Handling:
Invalid inputs are handled through thedefaultcondition in theswitch-case.
-
Initial Screen:
Prompts the user to input call duration. -
Provider Menu:
Displays provider options. -
Final Output:
Shows call costs based on duration and selected provider.
-
Compile the Program:
- Open the project in Code::Blocks.
- Compile and run the program.
-
Usage Instructions:
- Enter call duration.
- Select a provider.
- View the calculated call cost.
- Name: Ilham Muhammad Arif
- Course: Logic and Algorithm Practice
- Institution: Politeknik Negeri Semarang