Computers and Technology, 07.04.2020 21:09 nehamaan503
Print person1's kids, apply the IncNumKids() function, and print again, outputting text as below. End each line with newline. Sample output for below program: Kids: 3 New baby, kids now: 4
#include
using namespace std;
class PersonInfo {
public:
void SetNumKids(int personsKids);
void IncNumKids();
int GetNumKids() const;
private:
int numKids;
};
void PersonInfo::SetNumKids(int personsKids) {
numKids = personsKids;
return;
}
void PersonInfo::IncNumKids() {
numKids = numKids + 1;
return;
}
int PersonInfo::GetNumKids() const {
return numKids;
}
int main() {
PersonInfo person1;
person1.SetNumKids(3);
this->numKids = numKids;
return 0;
}
2) Define the missing function. licenseNum is created as: (100000 * customID) + licenseYear. Sample output:
Dog license: 77702014
#include
using namespace std;
class DogLicense{
public:
void SetYear(int yearRegistered);
void CreateLicenseNum(int customID);
int GetLicenseNum() const;
private:
int licenseYear;
int licenseNum;
};
void DogLicense::SetYear(int yearRegistered) {
licenseYear = yearRegistered;
return;
}
// FIXME: Write CreateLicenseNum()
/* Your solution goes here */
int DogLicense::GetLicenseNum() const {
return licenseNum;
}
int main() {
DogLicense dog1;
dog1.SetYear(2014);
dog1.CreateLicenseNum(777);
cout << "Dog license: " << dog1.GetLicenseNum() << endl;
return 0;
}
3) Define a constructor as indicated. Sample output for below program:
Year: 0, VIN: -1
Year: 2009, VIN: 444555666
#include
using namespace std;
class CarRecord {
public:
void SetYearMade(int originalYear);
void SetVehicleIdNum(int vehIdNum);
void Print() const;
CarRecord();
private:
int yearMade;
int vehicleIdNum;
};
// FIXME: Write constructor, initialize year to 0, vehicle ID num to -1.
/* Your solution goes here */
void CarRecord::SetYearMade(int originalYear) {
yearMade = originalYear;
return;
}
void CarRecord::SetVehicleIdNum(int vehIdNum) {
vehicleIdNum = vehIdNum;
return;
}
void CarRecord::Print() const {
cout << "Year: " << yearMade << ", VIN: " << vehicleIdNum << endl;
return;
}
int main() {
CarRecord familyCar;
familyCar. Print();
familyCar. SetYearMade(2009);
familyCar. SetVehicleIdNum(444555666);
familyCar. Print();
return 0;
}
4) Write a second constructor as indicated. Sample output:
User1: Minutes: 0, Messages: 0
User2: Minutes: 1000, Messages: 5000
#include
using namespace std;
class PhonePlan{
public:
PhonePlan();
PhonePlan(int numMinutes, int numMessages);
void Print() const;
private:
int freeMinutes;
int freeMessages;
};
PhonePlan::PhonePlan() { // Default constructor
freeMinutes = 0;
freeMessages = 0;
return;
}
// FIXME: Create a second constructor with numMinutes and numMessages parameters.
/* Your solution goes here */
void PhonePlan::Print() const {
cout << "Minutes: " << freeMinutes << ", Messages: " << freeMessages << endl;
return;
}
int main() {
PhonePlan user1Plan; // Calls default constructor
PhonePlan user2Plan(1000, 5000); // Calls newly-created constructor
cout << "User1: ";
user1Plan. Print();
cout << "User2: ";
user2Plan. Print();
return 0;
}
Answers: 3
Computers and Technology, 22.06.2019 00:00, lilyforeman5867
Match each vocabulary word to its definition.1. desktoppicture used to represent acomputer application2. domainnetwork protectionsoftware code that can be viewed,3. iconmodified, and redistributed for freethe background screen on acomputer monitor4. url5. blogan online journalthe part of an internet address that6. firewallrefers to a group of computers on anetworkonline database of web pages7. intranetnetwork for use by an individual8. open address of a web page or9. wikiresource
Answers: 2
Computers and Technology, 24.06.2019 00:30, lovemusic4
Setting up a home network using wireless connections is creating a a. vpn b. lan c. wan d. mini-internet
Answers: 2
Computers and Technology, 24.06.2019 01:10, jaileen84
Create a program that will take in a single x and y coordinate as the origin. after the input is provided, the output should be all of the coordinates (all 26 coordinates read from the “coordinates. json” file), in order of closest-to-farthest from the origin.
Answers: 1
Print person1's kids, apply the IncNumKids() function, and print again, outputting text as below. En...
Medicine, 15.02.2021 19:00
Mathematics, 15.02.2021 19:10
Mathematics, 15.02.2021 19:10
English, 15.02.2021 19:10
Mathematics, 15.02.2021 19:10