Sponsored Links


Results 1 to 8 of 8

Thread: cs201 assignment no 1 April 12 Spring 2011

  1. #1
    Administrator Xpert's Avatar
    Join Date
    May 2010
    Location
    Jhelum
    Posts
    6,233

    cs201 assignment no 1 April 12 Spring 2011

    Sponsored Links1



    Problem Statement: Rent A CAR

    You are required to write a program for RENT A CAR SYSTEM. The basic idea is that user will provide customer information, Car Model, and number of days. Upon this information your program will calculate the Amount for the Car. Rent Amount will be calculated on the Basis of Type of Model he / she is going to take on Rent and of Days on Rent. There are Types of Models available “2009”, “2010” and “2011”. For Model 2009 Minimum Rent per day is Rs. 5000/- for Model “2010” Amount is Rs. 8000/- and for “2011” Amount is Rs. 10,000/- Per Day.




    Detailed Description:

    1. The program should display

    Please provide customer Name:
    Please provide Car Model.
    Enter ‘A’ for Model 2009.
    Enter ‘B’ for Model 2010.
    Enter ‘C’ for Model 2011.


    Then your program should take these inputs,

    2. Depending upon the choices that user has entered, your program will further display the prompt

    3. If user has entered Car Model, then your program should prompt the user to enter the Car Number and No. of Days for which car is required.

    -----------------------------------------------------------------
    Model Name :
    Number of Days:
    -----------------------------------------------------------------

    4. After getting all this information, now write a function which will calculate rental/charged amount on the basis of this information.


    To calculate rental/charged amount we will use this formula:
    Rental Amount = charged amount * number of days

    Charged amount will be different for different Car Models as described above.



    After calculating Rent Amount for Car display it on the screen.




    Sample Output



    Please provide customer Name: Ahsan

    Please provide Car Model Description.

    Enter ‘A’ for Model 2009.
    Enter ‘B’ for Model 2010.
    Enter ‘C’ for Model 2011



    Please provide following information:

    Car No. : LWQ234
    Number of day’s: 3


    Final output should be like this:

    -----------------------------------------------------------------
    Customer Name: Ahsan
    Car Model : 2009
    Car No. : LWQ234
    Number of days: 03
    Your Rental Amount is: 15000
    -----------------------------------------------------------------


    Note:
    Your assignment must be uploaded/submitted on or before April 18, 2011. Make it sure to submit only Cpp file of your Assignment. Assignment in notepad format or MS Word format will not be accepted.


    Sponsored Links
    Attached Files Attached Files

  2. #2
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    Posts
    9,578

    Icon51 cs201 introduction to programing assignment no 1 solution 2011

    plz find the code and make changes

    Code:
    #include <iostream.h>
    #include <conio.h>
    
    double TotalPayAbleRent(int,int);
    main()
    {
          char name[20], choice,vehicle_number[20];
          int total_days,amount_of_day1,amount_of_day2,amount_of_day3,model1,model2,model3;
          model1 = 2009;
          model2 = 2010;
          model3 = 2011;
          amount_of_day1 = 5000;
          amount_of_day2 = 8000;
          amount_of_day3 = 10000;
          cout<<"=======CODDED BY: ALIMS(for those who are not much familiar with C++)=======";
          cout<<"\n"<<"provide customer name :";
          cin>>name;
          cout<<"Please provide Car Description";
          cout<<"\n"<<"Enter 'A' for model 2009";
          cout<<"\n"<<"Enter 'B' for model 2010";
          cout<<"\n"<<"Enter 'C' for model 2011";
          cin>>choice;
          cout<<"Please enter car number :";
          cin>>vehicle_number;
          cout<<"Please enter number of days :" ;
          cin>>total_days;
    
    
          if(choice=='a')
          {
    
                   cout<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
                   cout<<"Customer Name :" <<name;
                   cout<<"\n"<<"Car Model :" <<model1 ;
                   cout<<"\n"<<"Number of days :" <<total_days;
                   cout<<"\n"<<"Your Rental Amount is :" <<TotalPayAbleRent(amount_of_day1,total_days);
                   cout<<"\n"<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
          }
          else if(choice=='A')
          {
    
                   cout<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
                   cout<<"Customer Name :" <<name;
                   cout<<"\n"<<"Car Model :" <<model1 ;
                   cout<<"\n"<<"Number of days :" <<total_days;
                   cout<<"\n"<<"Your Rental Amount is :" <<TotalPayAbleRent(amount_of_day1,total_days);
                   cout<<"\n"<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
          }
          else if(choice=='B')
          {
    
                   cout<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
                   cout<<"Customer Name :" <<name;
                   cout<<"\n"<<"Car Model :" <<model2 ;
                   cout<<"\n"<<"Number of days :" <<total_days;
                   cout<<"\n"<<"Your Rental Amount is :" <<TotalPayAbleRent(amount_of_day2,total_days);
                   cout<<"\n"<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
          }
          else if(choice=='b')
          {
    
                   cout<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
                   cout<<"Customer Name :" <<name;
                   cout<<"\n"<<"Car Model :" <<model2 ;
                   cout<<"\n"<<"Number of days :" <<total_days;
                   cout<<"\n"<<"Your Rental Amount is :" <<TotalPayAbleRent(amount_of_day2,total_days);
                   cout<<"\n"<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
          }
          else if(choice=='C')
          {
    
                   cout<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
                   cout<<"Customer Name :" <<name;
                   cout<<"\n"<<"Car Model :" <<model3 ;
                   cout<<"\n"<<"Number of days :" <<total_days;
                   cout<<"\n"<<"Your Rental Amount is :" <<TotalPayAbleRent(amount_of_day3,total_days);
                   cout<<"\n"<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
          }
          else if(choice=='c')
          {
    
                   cout<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
                   cout<<"Customer Name :" <<name;
                   cout<<"\n"<<"Car Model :" <<model3 ;
                   cout<<"\n"<<"Number of days :" <<total_days;
                   cout<<"\n"<<"Your Rental Amount is :" <<TotalPayAbleRent(amount_of_day3,total_days);
                   cout<<"\n"<<"~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*.~*." <<endl;
          }
          else
          {
              cout<<"insaan ban kar sahi input do";
              }
        
          getch();
    }
    double TotalPayAbleRent(int rentofday,int tdays)
    {
        return rentofday*tdays;
    }
    Attached Files Attached Files

  3. #3
    gm mughal
    Guest

    Icon14

    i am using these cods but output is not display.

    Code:
    #include <iostream.h>
    main()
    {
          int days;
          int rent;
          char model;
          char name;
          char carNo;
          cout <<"Please provide customer name : \t";
          cin >>name;
          
          cout <<"Please Provide the model discription:\n";
          cout <<"\t Enter 'A' for Model 2009 :\n";
          cout <<"\t Enter 'B' for Model 2010 :\n";
          cout <<"\t Enter 'C' for Model 2011 :\n";
          cin >>model;
          
          cout <<"Please Provide the following discription:";
          cout <<"\nCarNo.\t\t";
          cin >>carNo;
          cout << "Enter days.";
          cin >>days;
          cout <<"\nRent per day for 2009 is Rs. 5000. \n";
          cout <<"Rent per day for 2010 is Rs. 8000. \n";
          cout <<"Rent per day for 2009 is Rs. 10000. \n";
          switch(model)
          {
          case   'A':
          case   'a':
                 cout << "Customer Name \t" <<name;
                 cout << "Car Model \t2009\n";
                 cout << "Car No.\t" <<carNo;
                 cout << "No of days\n" << days;
                 rent= amount(model*days);
                 cout <<"Your rental amount is :\t" << rent;
          break;
          case   'B':
          case   'b':
                 cout << "Customer Name \t" <<name;
                 cout << "Car Model \t2010\n";
                 cout << "Car No.\t" <<carNo;
                 cout << "No of days\n" << days;
                 rent= (days*8000);
                 cout <<"Your rental amount is :\t" << rent;
          break;
          case   'C':
          case   'c':
                 cout << "Customer Name \t" <<name;
                 cout << "Car Model \t2011\n";
                 cout << "Car No.\t" <<carNo ;
                 cout << "No of days\n" << days;
                 rent= (days*10000);
                 cout <<"Your rental amount is :\t" << rent;
          break;
          defualt:
                  cout <<"Please select only 2009,2010,2011. car models.";
          }
          system("pause");
    }
    int amount(char m, int d){
        if( m== 'A' || m== 'a')
        return (5000*d);
        
        else if( m== 'B' || m== 'b')
        return (8000*d);
        
        else if( m== 'C' || m== 'c')
        return (10000*d);
                              }
    error code bhi tu batao also attach .cpp file please

  4. #4
    Junior Member
    Join Date
    Nov 2010
    Posts
    2
    VUHELPER.....

    dear jis banday ki bani assignment aap ne upload ki hai wo mein hi hoon.. me Alims...
    and by the way.. yeh tou mene virtualinspire per upload ki thi... aap ne yahan per apnay name se kar di...????
    not fare....

  5. #5
    Junior Member
    Join Date
    Nov 2010
    Posts
    2
    int amount(char m, int d){
    if( m== 'A' || m== 'a')
    return (5000*d);

    else if( m== 'B' || m== 'b')
    return (8000*d);

    else if( m== 'C' || m== 'c')
    return (10000*d);
    }


    cod mein mistakes hain aap ke...
    yeh code apply karo
    int amount(char m, int d){
    if(( m== 'A') || (m== 'a'))
    {
    return 5000*d;
    }

    else if(( m== 'B') || (m== 'b'))
    {
    return 8000*d;
    }

    else if(( m== 'C') || (m== 'c'))
    {
    return 10000*d;
    }


    ohhoooo
    apka tou swtich statement mein bi mistakes hain aap ko tou coding bilkul nahin aati

  6. #6
    Junior Member
    Join Date
    Apr 2011
    Posts
    1
    This attached file is corrupted..(

  7. #7
    Administrator Xpert's Avatar
    Join Date
    May 2010
    Location
    Jhelum
    Posts
    6,233
    it is not you should learn how to run a .cpp file

  8. #8
    cs201 ki assigment #3 ka solution upload kro plzzzzzzzzz

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 04-14-2012, 09:30 PM
  2. Replies: 0
    Last Post: 03-11-2012, 06:07 PM
  3. Replies: 12
    Last Post: 12-27-2011, 06:44 PM
  4. Replies: 19
    Last Post: 11-05-2011, 03:48 AM
  5. Replies: 0
    Last Post: 04-08-2011, 08:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft | Jobs