We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Dear Student Please discus here about this Assignment :) . Thanks

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 8878

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

jo program is tarha kary return 0; say pahly   system("pause"); laga do  

 system("pause"); lagane se error de raha hai ka

system is not defined in this scope

errors aa rahian hain es main. Kiya code sy phele koi directory lagani hai??

koe btaye ga output rukti ku ni jaldi se chali jati hai????

@Fiinder system("pause"); add kro code k end pr output ruk jaye gi. 

 system("pause"); lagane se error de raha hai ka

system is not defined in this scope

 

/*
Assignment No : 3
VU-ID:
Name:
Date: 19/01/16 17:31
*/

#include<iostream>
#include <cstring>
using namespace std;

class Computer
{
private :
string Vendor;
string CPU;
int Hard_Disk;
int Ram;
public :
// setter functions
void setVendor(string vndr)
{
this->Vendor = vndr;
}
void setCPU(string cpu)
{
this->CPU = cpu;
}
void setHDD(int hdd)
{
this->Hard_Disk = hdd;
}
void setRam(int ram)
{
this->Ram = ram;
}
// getter funstions
string getVendor()
{
return Vendor;
}
string getCPU()
{
return CPU;
}
int getHDD()
{
return Hard_Disk;
}
int getRam()
{
return Ram;
}
// Default constructor
Computer()
{
cout"\n\nDefault constructor called....\n";
Vendor = "None";
CPU = "None";
Hard_Disk = 0;
Ram = 0;
}
// parameterized constructor
Computer(string vndr, string cpu, int ram, int hdd)
{
cout"\n\nParameterized constructor called....\n";
setVendor(vndr);
setCPU(cpu);
setHDD(hdd);
setRam(ram);
}
};
main()
{
Computer pc1;
cout"\nVendor : "pc1.getVendor();
cout"\nCPU : "pc1.getCPU();
cout"\nRAM : "pc1.getRam();
cout"\nHard Disk : "pc1.getHDD();

Computer pc2("Intel", "i5", 4, 500);

cout"\nVendor : "pc2.getVendor();
cout"\nCPU : "pc2.getCPU();
cout"\nRAM : "pc2.getRam();
cout"\nHard Disk : "pc2.getHDD();
coutendl;
cout"--------------------------------- "endl;

system ("pause");
return 0;
}

cs201 solution 2016

#include <iostream>
using namespace std;

class Computer{
private:
string Vendor;
string Cpu;
int Ram ;
int Hardisk ;



public :
Computer();
Computer(string Vin ,string Cp,int rm,int hr) {



Vendor=Vin;

Cpu=Cp;

Ram=rm;

Hardisk=hr;}
void show(){

cout Vendor" "endlCpu " "endl "Ram : " Ram" "endl"Hard Disk : "Hardisk" "endl;


};


void setVendor(string);
void setCpu(string);
void setRam(int);
void setHardisk(int);
string getVendor();
string getCpu();
int getRam();
int getHardisk();

};
Computer::Computer(){
Vendor;
Cpu;
Ram ;
Hardisk;


}

void Computer::setVendor(string Ven){
Ven= " :None";

Vendor=Ven;



}

void Computer::setCpu(string cap){
cap = " :None";
Cpu= cap;

}
void Computer::setRam(int r){

r = 0 ;
Ram = r;

}
void Computer::setHardisk(int h){
h = 0;
Hardisk = h;

}
string Computer::getVendor(){
return Vendor;

}

string Computer::getCpu(){
return Cpu;
}
int Computer::getRam(){
return Ram;


}
int Computer::getHardisk(){
return Hardisk;
}


int main(){

Computer sys ;
string Vin;
string Cp;
int rm;
int hr;
sys.setVendor(Vin);
sys.setCpu(Cp);
sys.setRam(rm);
sys.setHardisk(hr);
cout "The default Constructor is called....."endl;
cout "Vendor:"sys.getVendor()endl;
cout " Cpu: "sys.getCpu()endl;
cout "Ram:"sys.getRam()endl;
cout "Hard disk:" sys.getHardisk()endl;
cout endl;

cout "The parameterized Constructor is called......" endlendl;
Computer para(" Vendor : Intel"," CPU :i5",4, 500);
para.show();

return 0;

}

 CS201 Assignment 3(Solution)

  • First of all create class with the name of computer with following code:


         class computer{

          }

  • inside the class define 2 sections as private and public with following code:


        public: // for the public variables.
        void setModel(string s);
        string getModel();

         void setRamMemory(int i);
         int getRamMemory();
        
         computer();// define constructor without parameters
         computer(string, int);// define constructor with parameters
       
          private: // for the private variables.

          string Model;
          int RamMemory;

  • After this close the class and your code should look like this 

 




















  • Now start working on defined functions above" let us start with default values for the constructor without parameters..



computer::computer(){
Model="None";
RamMemory=0;
}

  • Now define the constructor's objects with values with following way:

computer::computer(string Model,int RamMemory){
setModel(Model);
setRamMemory(RamMemory);
}

  • After doing this start writing SETTER function's code with following way:

void computer::setModel(string s){
 Model=s;
}
void computer::setRamMemory(int i){
 RamMemory=i;
}

  • Same like this now write the code for GETTER functions defined above with following code:



string computer::getModel(){
return Model;
}
string computer::getRamMemory(){
return RamMemory;
}

  • Now come to the final point with displaying values in program with the following way:


int main()
 {
 
  cout "computer without paramerters" endl;
       //initialize the constructor and display
  computer comp1; cout"Model == " comp1.getModel() endl;

cout"RAM Memory == " comp1.getRamMemory() endl;
cout "computer with paramerters" endl;
computer comp2("IBM",5);
cout"Model == "comp2.getModel() endl;
cout"RAM Memory == " comp2.getRamMemory() endl;

  return 0;
 }

RSS

Latest Activity

+ daZzliNg DudE updated their profile
24 minutes ago
+ ! ! ! ! ! ! ! ! ! AG liked Moji's discussion CS 502 Assignment no 2
1 hour ago
Profile Iconosama butt, Umar Ahmed, MUHAMMAD MUZAMMIL BHUTTA and 9 more joined Virtual University of Pakistan
2 hours ago
Abdul Majid Jamil posted a photo
3 hours ago
Moji posted discussions
4 hours ago
+ ! ! ! ! ! Dîxîě Dûsť꧂ updated their profile
4 hours ago
+ ! ! ! ! ! ! maho+++ liked Azhar Sagar's discussion How to make srs Software Requirements Specification
4 hours ago
Aqsa Khan updated their profile
5 hours ago
+ IUUOƆƎUT + updated their profile
5 hours ago
+ M.Tariq Malik replied to Aijaz khan's discussion CS608 - Software Verification and Validation Assignment No. 2 Need Solution
5 hours ago
+ M.Tariq Malik liked Aijaz khan's discussion CS608 - Software Verification and Validation Assignment No. 2 Need Solution
5 hours ago
+ M.Tariq Malik replied to Waseem Aziz's discussion PROJECT MANAGEMENT (MGMT627)required Solution in the group MGMT627 Project Management
5 hours ago
+ M.Tariq Malik liked Waseem Aziz's discussion PROJECT MANAGEMENT (MGMT627)required Solution
5 hours ago
Ahsan Sandhu updated their profile
5 hours ago
Ahsan Sandhu liked Ahsan Sandhu's profile
6 hours ago
+ M.Tariq Malik replied to +¢αяєℓєѕѕ gιяℓ's discussion Best Places To Propose Someone :-P
6 hours ago
+ M.Tariq Malik liked +¢αяєℓєѕѕ gιяℓ's discussion Best Places To Propose Someone :-P
6 hours ago
+ M.Tariq Malik replied to waqas ahmad's discussion isl 201
6 hours ago
+ M.Tariq Malik liked waqas ahmad's discussion isl 201
6 hours ago
+ M.Tariq Malik replied to +¢αяєℓєѕѕ gιяℓ's discussion CS408 Human Computer Interaction Online Quiz No 01 Fall 2019 Solution Discussion Last Date: 21-11-2019 in the group CS408 Human Computer Interaction
6 hours ago

Today Top Members 

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service