BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Right Header

Register FAQ Community Calendar New Posts Navbar Right Corner
HOME BZU Mail Box Online Games Radio and TV Cricket All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan > Institute of Computing > Bachelor of Science in Information Technology > BsIT 3rd Semester > Object Oriented Programming

Object Oriented Programming By Mam Sidra Malik


Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1  
Old 23-09-2008, 01:09 PM
.BZU.'s Avatar


 
Join Date: Sep 2007
Location: near Govt College of Science Multan Pakistan
Posts: 9,693
Contact Number: Removed
Program / Discipline: BSIT
Class Roll Number: 07-15
.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute
Wink Assignment Questions from Exercise:6

Hello friends.. Madam sidra nay yeh question karnay ki di ay thay..

Question 2.:
Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay a 50 cent toll. Mostly they do, but sometimes a car goes by without paying. The tollbooth keeps track of the number of cars that have gone by, and of the total amount of money collected.
Model this tollbooth with a class called toll Booth. The two data items are a type unsigned int to hold the total number of cars, and a type double to hold the total amount of money collected. A constructor initializes both of these to 0. A member function called payingCar() increments the car total and adds 0.50 to the cash total. Another function, called nopayCar(), increments the car total but adds nothing to the cash total. Finally, a member function called display() displays the two totals. Make appropriate member functions const.
Include a program to test this class. This program should allow the user to push one key to count a paying car, and another to count a nonpaying car. Pushing the [Escape] key should cause the program to print out the total cars and total cash and then exit.


Question 5.: Start with the date structure in Exercise 5 in Chapter 4 and transform it into a date class. Its member data should consist of three ints: month, day, and year. It should also have two member functions: getdate(), which allows the user to enter a date in 12/31/97 format, and showdate(), which displays the date.


Question 6.: Extend the employee class of Exercise 4 to include a date class (see Exercise 5) and an etype enum (see Exercise 6 in Chapter 4). An object of the date class should be used to hold the date of first employment; that is, the date when the employee was hired. The etype variable should hold the employee’s type: laborer, secretary, manager, and so on. These two items will be private member data in the employee declaration, just like the employee number and salary. You’ll need to extend the getemploy() and putemploy() functions to obtain this new information from the user and display it. These functions will probably need switch statements to handle the etype variable. Write a main() program that allows the user to enter data for three employee variables, which then displays this data.
__________________
(¯`v´¯)
`*.¸.*`

¸.*´¸.*´¨) ¸.*´¨)
(¸.*´ (¸.
Bzu Forum

Don't cry because it's over, smile because it happened
Reply With Quote
  #2  
Old 24-09-2008, 11:44 PM
shmsa's Avatar
Grown up punk

 
Join Date: Oct 2007
Location: Muslim Town Multan
Posts: 195
Contact Number: 0322-6196713
Program / Discipline: BSIT
Class Roll Number: 07-22
shmsa is a jewel in the roughshmsa is a jewel in the roughshmsa is a jewel in the roughshmsa is a jewel in the rough
Default Re: Assignment Questions from Exercise:6

arry mamoon is ka solutionto likh deta ya to hamain b pata tha k kon say qus deay han
Reply With Quote
  #3  
Old 24-09-2008, 11:55 PM
.BZU.'s Avatar


 
Join Date: Sep 2007
Location: near Govt College of Science Multan Pakistan
Posts: 9,693
Contact Number: Removed
Program / Discipline: BSIT
Class Roll Number: 07-15
.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute
Default

Quote:
Originally Posted by shmsa View Post
arry mamoon is ka solutionto likh deta ya to hamain b pata tha k kon say qus deay han
Mamo kay bachay...
Abh mujhay na jo aa ain tu main kiya karon?
Chalo yeh lo Exercise 2 ka solution>>

book main hay na
__________________
(¯`v´¯)
`*.¸.*`

¸.*´¸.*´¨) ¸.*´¨)
(¸.*´ (¸.
Bzu Forum

Don't cry because it's over, smile because it happened
Reply With Quote
  #4  
Old 25-09-2008, 12:58 AM
BSIT07-01's Avatar
Addicted to Computer


 
Join Date: Sep 2007
Location: ------------
Age: 34
Posts: 1,309
Contact Number: ---------------
Program / Discipline: BSIT
Class Roll Number: 07-01
BSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant future
Default Re: Assignment Questions from Exercise:6

Solution of Exercise 6 in rough format but is working...
Bari Mushkil say bana hay...

Code:
#include <iostream>

#include<conio.h>
using namespace std;

char ch;

class employee
{
private:

enum etype{laborer,secretary,manager,accountant,executive,researcher};
etype x;
int employeeno;
float compensation;

class date
{
private:
int day,month,year;


public:
void getdate(int count)
{
cout<<"enter "<<count<<" Date : ";

cin>>day>>ch>>month>>ch>>year;


}
void showdate()
{
cout<<day<<ch<<month<<ch<<year<<endl;

}
};
public:

    date var;
    void putemploy()
    {
        static count=1;
        cout<<"Enter Employ "<<count<<" Number";
        cin>>employeeno;
        cout<<"Enter "<<count<<" Compensation";
        cin>>compensation;
        var.getdate(count);
        cout<<"enter "<<count<<" Employee Type";
        count++;
        
        switch(getch())
        {
        case 'l': x=laborer ; break;
        case 's': x=secretary ; break;
        case 'm': x=manager ; break;
        case 'a': x=accountant; break;
        case 'e': x=executive ; break;
        case 'r': x=researcher;
        
        }
        cout<<endl;
        



    }
    void getemploy()
    {
    cout<<"Employ No :"<<employeeno<<endl;
    cout<<"Employ Compensation : "<<compensation<<endl;
    cout<<"Employ Date : ";
    var.showdate();
    cout<<"Employ Type: ";

    switch(x){
    case 0: cout<<"laborer\n" ; break;
    case 1: cout<<"secretary\n" ; break;
    case 2: cout<<"manager\n" ; break;
    case 3: cout<<"accountant\n"; break;
    case 4: cout<<"executive\n" ; break;
    case 5: cout<<"researcher\n"; break;
    default: cout<<"Undefined\n";}}



};

void main()
{



    employee x[3]; 

for(int i=0; i<3;i++){

x[i].putemploy();
}

for(int j=0; j<3; j++)
 {
    x[j].getemploy();
}





}

Reply With Quote
  #5  
Old 25-09-2008, 01:18 AM
almahmood_pk's Avatar
I like My BSIT

 
Join Date: Nov 2007
Location: Multan,Mouza Nandla
Posts: 6
Contact Number: 03017460896
Program / Discipline: BIT
Class Roll Number: 07-41
almahmood_pk is on a distinguished road
Send a message via Yahoo to almahmood_pk
Default Re: Assignment Questions from Exercise:6

thanks for assignment
Reply With Quote
  #6  
Old 25-09-2008, 03:42 PM
Sheraz's Avatar
SheikhooOo

 
Join Date: Feb 2008
Location: Outside home.... :D
Age: 35
Posts: 19
Contact Number: 0332-4148721
Program / Discipline: BSIT
Class Roll Number: 07-16
Sheraz is on a distinguished road
Default Re: Assignment Questions from Exercise:6

saalaam

aaj meray pass book naihi thi aur accidently net aa raha hay...........
thanx tum nay meray liay post kiay...

love youuuuuuuuuuuuuu ma babe
Reply With Quote
Reply

Tags
assignment, c++, exercise6, lectures, questions


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pathan Exercise thecool Funny/Comedy 0 30-08-2010 08:29 AM
Brain Exercise usman_latif_ch Chit Chat 0 11-04-2009 07:55 AM
Assignment} Exercise#4 Question 9 and 11 .BZU. Object Oriented Programming 2 18-12-2008 01:47 PM
Exercise of Chapter # 7 .BZU. Web Development 3 02-12-2007 02:22 PM
Assignment#4 Model for webdevelopment assignment .BZU. Web Development 2 18-11-2007 06:49 PM

Best view in Firefox
Almuslimeen.info | BZU Multan | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 03:07 AM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.