Sponsored Links


Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Need CS201 Assignment No 5 Solution

  1. #1

    Icon51 Need CS201 Assignment No 5 Solution

    Sponsored Links





    Please give the solution please
    assignment is :

    Problem Statement: Multiplication of two objects of same class
    You are required to write a class. Class should have an array of 10 integers as its private data member.
    Class should have
    A default constructor which will initialize all array elements with zero.
    Getter and setter functions
    An operator overloading function which will overload * operator for this class.
    You are required to create three objects of the same class.
    . You must assign values to first and second objects through setter functions. You can either take input arrays from user or use hard coded values.
     Display the values of first and second object through getter functions.
     Multiply both objects and store the result of multiplication in third object.
     Multiplication means the 1st element of member array of object1 should be multiplied by 1st element of member array of object2. Similarly, 2nd element should be multiplied with 2nd and so on. In the end, display the result stored in third object.
     Your program should support the statement like a = b * c, where a, b and c are objects of the same class.

  2. #2
    Administrator Xpert's Avatar Users Flag!
    Join Date
    May 2010
    Location
    Jhelum
    Posts
    5,730
    dear we already post solution search it please

  3. #3
    Junior Member Death race's Avatar Users Flag!
    Join Date
    Jul 2010
    Posts
    14
    plz send cs 201 5th assignment i need this plz

  4. #4
    but it is not fine solution
    samina javed

  5. #5
    Junior Member
    Join Date
    Nov 2010
    Posts
    9
    Xpert bhai plz cs201 ki 5th Assignment ka solution uload kr do

  6. #6
    Junior Member
    Join Date
    Nov 2010
    Posts
    9
    search kiya hai liken 5th Assignment ka solution nhi mila plz ap upload kr do na

  7. #7
    Administrator Xpert's Avatar Users Flag!
    Join Date
    May 2010
    Location
    Jhelum
    Posts
    5,730
    kesi baten ker raha ho Mian.

  8. #8
    gm mughal
    Guest
    #include<iostream.h>
    #include<fstream.h>
    main()
    {
    ifstream bill;
    char file []="Elec_Bil.txt";
    const int a=100;
    char fullText[a];
    bill.open(file);
    if(!bill)
    {
    cout<<"Error the file is not exist"<<file<<endl;
    exit(1);
    }
    while(!bill.eof())
    {
    bill.getline(fullText,a);
    cout << fullText << endl;
    }
    bill.close();
    system("pause");
    }

  9. #9
    Junior Member
    Join Date
    Nov 2011
    Posts
    3

    Icon9

    Quote Originally Posted by Xpert View Post
    kesi baten ker raha ho Mian.
    plz send the solution of 5th assignment of cs201 and 4th assignment of mth202.

  10. #10
    Junior Member
    Join Date
    May 2012
    Posts
    10

    Icon20 Dr Ijaz Khan

    #include<iostream>
    #include<conio.h>
    #include<stdlib.h>
    using namespace std;
    class Customer
    {
    private:
    string Name;
    int CustomerId;
    int Spending;
    int tax;
    int discount;
    int totalbill;
    public:
    void setName(string);
    int setCustomerId(int);
    int setSpending(int);
    int getName(string);
    int getCustomerId(int);
    int getSpending(int);
    void display()
    {
    cout<<"Customer Name : "<<Name<<endl<<endl<<"ID : "<<CustomerId<<endl<<endl<<"Spending : "<<Spending<<endl<<endl;
    }
    Customer();
    Customer(string, int, int);
    friend ostream & operator<<(ostream &, Customer&);
    friend istream & operator>>(istream &, Customer&);
    friend ostream &star(ostream &);
    };
    ostream & star(ostream & output)
    {
    output<<"*";
    return output;
    }
    Customer::Customer()
    {
    Name="No Name";
    CustomerId=0;
    Spending=0;
    }
    Customer::Customer(string s, int i, int j)
    {
    Name=s;
    CustomerId=i;
    Spending=j;
    }
    istream & operator>>(istream & input, Customer &c)
    {
    cout<<"Enter the name of customer : ";
    input>>c.Name;
    cout<<"Enter the customer-id : ";
    input>>c.CustomerId;
    cout<<"Enter the Spending : ";
    input>>c.Spending;
    return input;
    }
    ostream & operator<<(ostream & output, Customer &c)
    {
    for(int i=0;i<55;i++)
    {
    if(i==25)
    {
    output<<"Customer Bill Information";
    }
    else
    {
    output<<star;
    }
    }
    output<<endl;
    output<<"Name :";
    for(int a=0;a<21;a++)
    {
    if(a==20)
    {
    output<<c.Name<<endl;
    }

    else
    {
    output<<star;
    }
    }
    output<<"ID :";
    for(int a=0;a<23;a++)
    {
    if(a==22)
    {
    output<<c.CustomerId<<endl;
    }

    else
    {
    output<<star;
    }
    }
    output<<"Spending :";
    for(int a=0;a<19;a++)
    {
    if(a==18)
    {
    output<<c.Spending<<endl;
    }

    else
    {
    output<<star;
    }
    }

    if(c.Spending<=5000)
    {
    c.tax=(c.Spending*5)/100;
    c.discount=(c.Spending*1)/100;
    c.totalbill=c.Spending+c.tax-c.discount;
    output<<"Tax :";
    for(int a=0;a<27;a++)
    {
    if(a==26)
    {
    output<<c.tax<<endl<<"Discount :";
    for(int a=0;a<19;a++)
    {
    if(a==18)
    {
    output<<c.discount<<endl<<"Total Bill :";
    for(int a=0;a<17;a++)
    {
    if(a==16)
    {
    output<<c.totalbill<<endl;
    }

    else
    {
    output<<star;
    }
    }

    }

    else
    {
    output<<star;
    }
    }


    }

    else
    {
    output<<star;
    }
    }

    }
    else if(c.Spending>5000 & c.Spending<10000)
    {
    c.tax=(c.Spending*10)/100;
    c.discount=(c.Spending*2)/100;
    c.totalbill=c.Spending+c.tax-c.discount;
    output<<"Tax :";
    for(int a=0;a<27;a++)
    {
    if(a==26)
    {
    output<<c.tax<<endl<<"Discount :";
    for(int a=0;a<19;a++)
    {
    if(a==18)
    {
    output<<c.discount<<endl<<"Total Bill :";
    for(int a=0;a<17;a++)
    {
    if(a==16)
    {
    output<<c.totalbill<<endl;
    }

    else
    {
    output<<star;
    }
    }

    }

    else
    {
    output<<star;
    }
    }


    }

    else
    {
    output<<star;
    }
    }

    }

    else if(c.Spending>10000)
    {
    c.tax=(c.Spending*15)/100;
    c.discount=(c.Spending*3)/100;
    c.totalbill=c.Spending+c.tax-c.discount;
    output<<"Tax :";
    for(int a=0;a<27;a++)
    {
    if(a==26)
    {
    output<<c.tax<<endl<<"Discount :";
    for(int a=0;a<19;a++)
    {
    if(a==18)
    {
    output<<c.discount<<endl<<"Total Bill :";
    for(int a=0;a<17;a++)
    {
    if(a==16)
    {
    output<<c.totalbill<<endl;
    }

    else
    {
    output<<star;
    }
    }

    }

    else
    {
    output<<star;
    }
    }


    }

    else
    {
    output<<star;
    }
    }

    }
    return output;
    }

    main()
    {
    Customer obj;
    cin>>obj;
    cout<<obj;
    system("pause");
    }

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 15
    Last Post: 01-11-2012, 12:19 PM
  2. CS201 Assignment 4 Solution Last Date 15 July 2010
    By Guru in forum Assignments & Solutions
    Replies: 1
    Last Post: 07-15-2010, 07:57 PM
  3. CS201 Assignment 4 Solution, June 2010
    By viki in forum Assignments & Solutions
    Replies: 5
    Last Post: 07-01-2010, 07:26 PM
  4. Replies: 0
    Last Post: 05-16-2010, 12:26 AM
  5. CS201 Solution 2nd Assignment Spring 2010 May 4
    By viki in forum Assignments & Solutions
    Replies: 0
    Last Post: 05-04-2010, 05:04 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