C++ project

7,317 views 19 slides Feb 20, 2015
Slide 1
Slide 1 of 19
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19

About This Presentation

c++ program


Slide Content

C++ Name:- Sonu.S.S Class:- 11.B Roll No:- 30 School:- Indian School Darsait Wage Calculator

Contents Sl. No Name Page. No 1 Acknowledgement 1 2 Introduction 2 3 System Requirement 3 4 Source 4 5 Output 13 6 Conclusions 16 7 Reference 17

Acknowledgment At the outset, I would like to express my sincere gratitude to my school, for providing me with such an opportunity to showcase my skills, my teachers for their guidance; and to each and every one who contributed to making this project a reality. Above all, I would like to thank God the Almighty for giving me the strength and endurance to undertaken this project and execute it to the best of my abilities. WageCalculator 1

Introduction The program is created to help the user calculate the wage of his employees. It accepts the hours the employee worked and the wage to be paid per hour. It helps to calculate wages for X no of employees. The program is written in both user friendly and compiler friendly manner. The program source contains comments which helps in the readability of the program. The program also have used user defined functions and array of objects. WageCalculator 2

System Requirements Hardware OS Microsoft® Windows Vista™ Home Premium System Name DELL-PC System Model Studio 1537 Processor Intel(R) Core(TM)2 Duo CPU T6400 @ 2.00GHz, 2000 Mhz, 2 Core(s), 2 Logical Processor(s) Software Borland C++ for Windows Version 3.1 WageCalculator 3

Source #include < iostream.h > #include< stdlib.h > // function prototyping int menu(); // funciton to display the menu void enter(); // function to enter info void report(); // function to print report // Global variables: char name[20][80];// this array holds employee names char phone[20][20];// their phone numbers float hours[20]; // hours worked per week float wage[20]; // wage int choice; int main() WageCalculator 4

{ do { choice = menu(); // get selection switch(choice) { case 0: break; case 1: enter(); break; case 2: report(); break; default: cout << "Try again.\n\n"; } } while(choice != 0); return 0; // Return a user's selection. } WageCalculator 5

int menu() { int choice; cout << "0. Quit\n"; cout << "1. Enter information\n"; cout << "2. Report information\n"; cout << "\ nChoose one: "; cin >> choice; return choice; } void enter() // Enter information. { int i,n ; WageCalculator 6

cout <<"\n enter number of employees"; cin >>n; for(i=0; i<n; i++) { cout << "Enter last name: "; cin >> name[i]; cout << "Enter phone number: "; cin >> phone[i]; cout << "Enter number of hours worked: "; cin >> hours[i]; cout << "Enter wage: "; cin >> wage[i]; } } WageCalculator 7

// Display report. void report() { int i,n ; cout <<"\n enter number of employees to be reported"; cin >>n; for(i=0; i<n; i++) { cout << name[i] << ' ' << phone[i] << '\n'; cout << "Pay for the week: " << wage[i] * hours[i]; cout << '\n'; } } int main() WageCalculator 8

{ do { choice = menu(); // get selection switch(choice) { case 0: break; case 1: enter(); break; case 2: report(); break; default: cout << "Try again.\n\n"; } } while(choice != 0); return 0; // Return a user's selection. } WageCalculator 9

int menu() { int choice; cout << "0. Quit\n"; cout << "1. Enter information\n"; cout << "2. Report information\n"; cout << "\ nChoose one: "; cin >> choice; return choice; } // Enter information. void enter() { WageCalculator 10

int i; for(i=0; i<2; i++) { cout << "Enter last name: "; cin >> name[i]; cout << "Enter phone number: "; cin >> phone[i]; cout << "Enter number of hours worked: "; cin >> hours[i]; cout << "Enter wage: "; cin >> wage[i]; } } WageCalculator 11

// Display report. void report() { int i; for(i=0; i<2; i++) { cout << name[i] << ' ' << phone[i] << '\n'; cout << "Pay for the week: " << wage[i] * hours[i]; cout << '\n'; } } WageCalculator 12

Output WageCalculator 13

WageCalculator 14

WageCalculator 15

Conclusion The above program accepts the details of the number of employees the user wants to enter. The employees details are accepted. The hours the employee worked ant the wage per hour is entered. Te total wage to be paid to the employee is calculated. If the user wants the details of the selected no of employees are displayed. It helps the user to pay the wages of the employee. WageCalculator 16

Reference Book Name Author Publisher Computer Science with C++ (class 11) Sumita Arora Dhanpat Rai & Co.( Pvt ).Ltd WageCalculator 17