Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could someone please look at the code bellow and rewrite it with deatiled java //comments please? This will help me understand it better, Thank you!

Could someone please look at the code bellow and rewrite it with deatiled java //comments please?

This will help me understand it better, Thank you!

public class Person {

private String name; private String address; private String phoneNumber;

public Person(String name, String address, String phoneNumber) { this.name = name; this.address = address; this.phoneNumber = phoneNumber; }

public String getAddress() { return address; }

public void setAddress(String address) { this.address = address; }

public String getName() { return name; }

public void setName(String name) { this.name = name; }

public String getPhoneNumber() { return phoneNumber; }

public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } }

====================================================================

public class Customer extends Person {

private int customerNumber; private boolean onList;

public Customer(String name, String address, String phoneNum, int number, boolean onList) { super(name, address, phoneNum); this.customerNumber = number; this.onList = onList; }

public int getCustomerNumber() { return customerNumber; }

public void setCustomerNumber(int customerNumber) { this.customerNumber = customerNumber; }

public boolean isOnList() { return onList; }

public void setOnList(boolean onList) { this.onList = onList; } }

=======================================================================

public class CustomerDemo {

public static void main(String[] args) {

Customer customer1 = new Customer("Judy Smith", "123 Maple Lane", "555-305-9876", 1, true); Customer customer2 = new Customer("Bob White", "456 Oak Road", "555-895-4931", 2, true); Customer customer3 = new Customer("Garry Goodman", "789 Acorn Avenue", "555-587-2983", 3, false);

System.out.println("Customer 1:"); System.out.println("\tName: " + customer1.getName()); System.out.println("\tAddress: " + customer1.getAddress()); System.out.println("\tPhone Number: " + customer1.getPhoneNumber()); System.out.println("\tCustomer Number: " + customer1.getCustomerNumber()); System.out.println("\tOn Mailing List: " + customer1.isOnList());

System.out.println("Customer 2:"); System.out.println("\tName: " + customer2.getName()); System.out.println("\tAddress: " + customer2.getAddress()); System.out.println("\tPhone Number: " + customer2.getPhoneNumber()); System.out.println("\tCustomer Number: " + customer2.getCustomerNumber()); System.out.println("\tOn Mailing List: " + customer2.isOnList());

System.out.println("Customer 3:"); System.out.println("\tName: " + customer3.getName()); System.out.println("\tAddress: " + customer3.getAddress()); System.out.println("\tPhone Number: " + customer3.getPhoneNumber()); System.out.println("\tCustomer Number: " + customer3.getCustomerNumber()); System.out.println("\tOn Mailing List: " + customer3.isOnList()); }

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

What is linear transformation? Define with example

Answered: 1 week ago