1. Create class named Person with the following public (a) getters: i. string ge
ID: 3664134 • Letter: 1
Question
1. Create class named Person with the following public (a) getters: i. string getLastName() ii. string getPassword() (b) setters: i. void setLastName(string newLastName) ii. void setPassword(string password)
2. Create class named Book with the following public (a) getters i. string getTitle() ii. string getAuthor() (b) setters i. void setTitle(string title) ii. void setAuthor(string author)
Keep specication of each class in a searate le from the implementation of the methods of this class. That is, create 4 les (2 .cpp les and 2 .h les).
Explanation / Answer
public class Person
{
private String name;
private String password;
public void createpassword()
{
this.password=password(pwd)
}
public void setPassword(String p)
{
password=p;
}
public String getPassword()
{
return password;
}
public void setLastname(String a)
{
lastname=a;
}
public String getLastname()
{
return lastname;
}
2
public class Book
{
private String title;
private String author;
public void setTitle(String t)
{
title=t;
public String getTitle()
{
return title;
}
public void setAuthor(String a)
{
author=a;
}
public String getAuthor()
{
return author;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.