Explanation of Solution
a.
Method heading for each method:
- • Method heading for access method of each attribute:
- ○ Access method for person first name is “public String getPersonFirstName()”.
- ○ Access method for person last name is “public String getPersonLastName()”.
- ○ Access method for person email address name is “public String getPersonEmailAddress()”...
Explanation of Solution
b.
Preconditions and postconditions of each method:
- • Precondition and postcondition of access method for each attribute.
- ○ For method “getPersonFirstName()”:
- ■ Precondition: None
- ■ Postcondition: Returns the first name of given person.
- ○ For method “getPersonLastName()”:
- ■ Precondition: None
- ■ Postcondition: Returns the last name of given person.
- ○ For method “getPersonEmailAddress()”:
- ■ Precondition: None
- ■ Postcondition: Returns the email address of given person.
- ○ For method “getPersonTelephoneNumber()”:
- ■ Precondition: None
- ■ Postcondition: Returns the telephone number of given person.
- ○ For method “getPersonFirstName()”:
- • Precondition and postcondition of “changeEmailAddress(String nEmail)” method...
Explanation of Solution
c.
Test class for some Java statement:
//Create object "p1" for "PersonAddress" class
PersonAddress p1 = new PersonAddress();
//Create object "p2" for "PersonAddress" class
PersonAddress p2 = new PersonAddress();
//Create object "p3" for "PersonAddress" class
PersonAddress p3 = new PersonAddress();
//Set values for "p1" by calling method "setPersonAddress"
p1.setPersonAddress("John", "Merry", "john123@aaa.com", "123-4567");
//Set values for "p2" by calling method "setPersonAddress"
p2.setPersonAddress("John", "Merry", "jr@ccc.com", "123-7654");
//Set values for "p3" by calling method "setPersonAddress"
p3.setPersonAddress("Jansi", "Rose", "htr@aaa.com", "333-4444");
//Display the statement
System.out.println("Values of attributes for person 1.");
//Display person "p1" first name by calling method "getPersonFirstName"
System.out.println("First Name: " + p1.getPersonFirstName());
//Display person "p1" last name by calling method "getPersonLastName"
System.out.println("Last Name: " + p1.getPersonLastName());
//Display person "p1" email address by calling method "getPersonEmailAddress"
System.out.println("Email Address: " + p1.getPersonEmailAddress());
//Display person "p1" telephone number by calling method "getPersonTelephoneNumber"
System.out.println("Telephone Number: " + p1.getPersonTelephoneNumber());
System.out.println();
//Display the given statement
System...
Explanation of Solution
d.
Implementation of class:
PersonAddress.java:
//Import package
import java.util.Scanner;
//Define class "PersonAddress"
public class PersonAddress
{
//Declare required variables in "private" access specifier
private String first_Name;
private String last_Name;
private String email_addr;
private String telephone_number;
//Set value for "PersonAddress" class
public void setPersonAddress(String f, String l, String e, String p)
{
//Assign value to given instance variables
first_Name = f;
last_Name = l;
email_addr = e;
telephone_number = p;
}
//Access method for person first name
public String getPersonFirstName()
{
//Returns person first name
return first_Name;
}
//Access method for person last name
public String getPersonLastName()
{
//Returns person last name
return last_Name;
}
//Access method for person email address
public String getPersonEmailAddress()
{
//Returns person email address
return email_addr;
}
//Access method for person telephone number
public String getPersonTelephoneNumber()
{
//Returns person telephone number
return telephone_number;
}
//Method for change person Email Address
public void changeEmailAddress(String nEmail)
{
//Assign "email_addr" to "nEmail"
email_addr = nEmail;
}
//Method for change person PhoneNumber
public void changePhoneNumber(String nPhone)
{
//Assign "telephone_number" to "nPhone"
telephone_number = nPhone;
}
//Method for check two persons are equal
public boolean equalMethod(PersonAddress otherPerson)
{
//Returns true if persons are equal
return last_Name.equals(otherPerson.last_Name) && first_Name.equals(otherPerson.first_Name);
}
//Define main function
public static void main(String[] args)
{
//Create object "p1" for "PersonAddress" class
PersonAddress p1 = new PersonAddress();
//Create object "p2" for "PersonAddress" class
PersonAddress p2 = new PersonAddress();
//Create object "p3" for "PersonAddress" class
PersonAddress p3 = new PersonAddress();
//Set values for "p1" by calling method "setPersonAddress"
p1.setPersonAddress("John", "Merry", "john123@aaa.com", "123-4567");
//Set values for "p2" by calling method "setPersonAddress"
p2.setPersonAddress("John", "Merry", "jr@ccc.com", "123-7654");
//Set values for "p3" by calling method "setPersonAddress"
p3.setPersonAddress("Jansi", "Rose", "htr@aaa.com", "333-4444");
//Display the statement
System.out.println("Values of attributes for person 1.");
//Display person "p1" first name by calling method "getPersonFirstName"
System.out.println("First Name: " + p1.getPersonFirstName());
//Display person "p1" last name by calling method "getPersonLastName"
System.out.println("Last Name: " + p1.getPersonLastName());
//Display person "p1" email addressby calling method "getPersonEmailAddress"
System...
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
- Modern life has been impacted immensely by computers. Computers have penetrated every aspect of oursociety, either for better or for worse. From supermarket scanners calculating our shopping transactionswhile keeping store inventory; robots that handle highly specialized tasks or even simple human tasks,computers do much more than just computing. But where did all this technology come from and whereis it heading? Does the future look promising or should we worry about computers taking over theworld? Or are they just a necessary evil? Provide three references with your answer.arrow_forwardWhat are the steps you will follow in order to check the database and fix any problems with it? Have in mind that you SHOULD normalize it as well. Describe in full, consider the following:• Taking the database offline is not allowed since people are connected to it.• Personal data might be bridged and not secured. Provide three refernces with you answerarrow_forwardYou are called by your supervisor to go and check a potential data bridge problem. What are the stepsyou will follow in order to check the database and fix any problems with it? Have in mind that youSHOULD normalize it as well. Describe in full, consider the following:• Taking the database offline is not allowed since people are connected to it.• Personal data might be bridged and not secured. Provide three refernces with you answerarrow_forward
- (A) A cellular system has 12 microcells with 10 channels per cell. The microcells are split into 3 microcells, and each microcell is further split into 4 picocells. Determine the number of channels available in system after splitting into picocelles.arrow_forwardQuestion 8 (10 points) Produce a relational schema diagram that corresponds to the following ER diagram for a Vacation Property Rentals database. Your relational schema diagram should include primary & foreign keys. Upload your relational schema diagram as a PDF document. Don't forget that the relation schemas for "Beach Property" and "Mountain Property" should each have primary keys. FYI: "d" in this notation denotes a subclass. Figure 2: ER Diagram for Question 8 id first RENTER name middle last address phone email 1 signs N id begin date RENTAL AGREEMENT end date amount N street address books city id 1 state address num. rooms PROPERTY zip code base rate type propertyType blocks to beach activity "B" "M" BEACH PROPERTY MOUNTAIN PROPERTYarrow_forwardNotes: 1) Answer All Question, 2) 25 points for each question QI Figurel shows the creation of the Frequency Reuse Pattern Using the Cluster Size K: (A) illustrates how i and j can be used to locate a co-channel cell. huster 3 Cluster Cluster 2 X=7(i=2,j1)arrow_forward
- You are called by your supervisor to go and check a potential data bridge problem. What are the stepsyou will follow in order to check the database and fix any problems with it? Have in mind that youSHOULD normalize it as well. Describe in full, consider the following taking the database offline is not allowed since people are connected to it and how personal data might be bridged and not secured.Provide three references with you answer.arrow_forwardYou are called by your supervisor to go and check a potential data bridge problem. What are the stepsyou will follow in order to check the database and fix any problems with it? Have in mind that youSHOULD normalize it as well. Describe in full, consider the following:• Taking the database offline is not allowed since people are connected to it.• Personal data might be bridged and not secured. Provide three refernces with you answerarrow_forwardYou are called by your supervisor to go and check a potential data bridge problem. What are the stepsyou will follow in order to check the database and fix any problems with it? Have in mind that youSHOULD normalize it as well. Describe in full, consider the following:• Taking the database offline is not allowed since people are connected to it.• Personal data might be bridged and not secured. Provide three refernces with you answer from websitesarrow_forward
- Modern life has been impacted immensely by computers. Computers have penetrated every aspect of oursociety, either for better or for worse. From supermarket scanners calculating our shopping transactionswhile keeping store inventory; robots that handle highly specialized tasks or even simple human tasks,computers do much more than just computing. But where did all this technology come from and whereis it heading? Does the future look promising or should we worry about computers taking over theworld? Or are they just a necessary evil? Provide three references with your answer.arrow_forwardObjective: 1. Implement a custom Vector class in C++ that manages dynamic memory efficiently. 2. Demonstrate an understanding of the Big Five by managing deep copies, move semantics, and resource cleanup. 3. Explore the performance trade-offs between heap and stack allocation. Task Description: Part 1: Custom Vector Implementation 1. Create a Vector class that manages a dynamically allocated array. 。 Member Variables: ° T✶ data; // Dynamically allocated array for storage. std::size_t size; // Number of elements currently in the vector. std::size_t capacity; // Maximum number of elements before reallocation is required. 2. Implement the following core member functions: Default Constructor: Initialize an empty vector with no allocated storage. 。 Destructor: Free any dynamically allocated memory. 。 Copy Constructor: Perform a deep copy of the data array. 。 Copy Assignment Operator: Free existing resources and perform a deep copy. Move Constructor: Transfer ownership of the data array…arrow_forward2.68♦♦ Write code for a function with the following prototype: * Mask with least signficant n bits set to 1 * Examples: n = 6 -> 0x3F, n = 17-> 0x1FFFF * Assume 1 <= n <= w int lower_one_mask (int n); Your function should follow the bit-level integer coding rules Be careful of the case n = W.arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning