Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You have been asked to develop an application that will be used by CS265 Web Sho

ID: 3715101 • Letter: Y

Question

You have been asked to develop an application that will be used by CS265 Web Shopping Network (WSN). First you need to design a class that will be used to represent every customer who makes purchases with C$265 WSN using their CS265 WSN credit card. The class should contain the following properties/attributes (private) 1. customer first name 2. customer last name 3. customer email address 4. customer alias 5, customer CS265 credit card account number 6. customer PIN/password 7. customer balance 8. customer limit The class should also contain the following methods (public) 1. 2. 3. constructor with parameters getter for each data field setter for each data field Instructions 1. Create folder named CS265WSN 2. Inside this folder, create the PHP class (WSNCustomerClass.php) using the information from above. 3. Inside this folder, write test drivers for the WSNCustomerClass PHP class. a. TestDriverl.php: Initialize attributes using the constructor with parameters. Use getters to b. TestDriver2.php: Initialize attributes using the constructor with parameters then modify c. TestDriver3.php: Initialize attributes using constructor with parameters (parameters are access and displav attributes. attributes with setters. Use getters to access and display attributes. read in from a data file. Use ? to separate data members). (Use it to create an array of objects). Use getters to access and display attributes. TestDriver4.php: Initialize attributes using constructor with parameters (parameters are read in from a data file. Use ? to separate data members). (Use it to create an array of objects). Use getters to access and display attributes. Then modify attributes with setters. Use getters to access and display the updated attributes. d.

Explanation / Answer

//first---

<?php

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/**
* Description of WSNCustomerClass
*
* @author Administrator
*/
class WSNCustomerClass {
    private $customer_first_name;
    private $customer_last_name;
    private $customer_email_address;
    private $customer_alias;
    private $customer_CS265_credit_card_account_number;
    private $customer_pin_password;
    private $customer_balance;
    private $customer_limit;
  
    public function __construct($customer_first_name, $customer_last_name, $customer_email_address, $customer_alias, $customer_CS265_credit_card_account_number, $customer_pin_password, $customer_balance, $customer_limit) {
        $this->customer_first_name = $customer_first_name;
        $this->customer_last_name = $customer_last_name;
        $this->customer_email_address = $customer_email_address;
        $this->customer_alias = $customer_alias;
        $this->customer_CS265_credit_card_account_number = $customer_CS265_credit_card_account_number;
        $this->customer_pin_password = $customer_pin_password;
        $this->customer_balance = $customer_balance;
        $this->customer_limit = $customer_limit;
    }
  
    public function getCustomer_first_name() {
        return $this->customer_first_name;
    }

    public function getCustomer_last_name() {
        return $this->customer_last_name;
    }

    public function getCustomer_email_address() {
        return $this->customer_email_address;
    }

    public function getCustomer_alias() {
        return $this->customer_alias;
    }

    public function getCustomer_CS265_credit_card_account_number() {
        return $this->customer_CS265_credit_card_account_number;
    }

    public function getCustomer_pin_password() {
        return $this->customer_pin_password;
    }

    public function getCustomer_balance() {
        return $this->customer_balance;
    }

    public function getCustomer_limit() {
        return $this->customer_limit;
    }

    public function setCustomer_first_name($customer_first_name) {
        $this->customer_first_name = $customer_first_name;
    }

    public function setCustomer_last_name($customer_last_name) {
        $this->customer_last_name = $customer_last_name;
    }

    public function setCustomer_email_address($customer_email_address) {
        $this->customer_email_address = $customer_email_address;
    }

    public function setCustomer_alias($customer_alias) {
        $this->customer_alias = $customer_alias;
    }

    public function setCustomer_CS265_credit_card_account_number($customer_CS265_credit_card_account_number) {
        $this->customer_CS265_credit_card_account_number = $customer_CS265_credit_card_account_number;
    }

    public function setCustomer_pin_password($customer_pin_password) {
        $this->customer_pin_password = $customer_pin_password;
    }

    public function setCustomer_balance($customer_balance) {
        $this->customer_balance = $customer_balance;
    }

    public function setCustomer_limit($customer_limit) {
        $this->customer_limit = $customer_limit;
    }
  


}


//---second data file:

customer_first_name?this is first name
customer_last_name?this is last name
customer_email_address?this is email address
customer_alias?this is alias
customer_CS265_credit_card_account_number?232342343859034
customer_pin_password?this is password
customer_balance?100
customer_limit?200

//--- class TestDriver3.php

<?php

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include ('WSNCustomerClass.php');
/**
* Description of TestDriver3
*
* @author Administrator
*/
class TestDriver3 {
  
    protected $obj;

    public function __construct() {
      
        $lines = file('data.txt', FILE_IGNORE_NEW_LINES);
        $data=array();
        foreach ($lines as $value) {
            $ar= explode("?", $value);
            if(is_array($ar)){$data[$ar[0]]=$ar[1];}
        }
        if(count($data)==8){
            $this->obj=new WSNCustomerClass($data['customer_first_name'], $data['customer_last_name'], $data['customer_email_address'], $data['customer_alias'], $data['customer_CS265_credit_card_account_number'], $data['customer_pin_password'], $data['customer_balance'], $data['customer_limit']);
        }
      
    }
  
    public function display_attributes() {
        echo $this->obj->getCustomer_first_name()." ";
        echo $this->obj->getCustomer_last_name()." ";
        echo $this->obj->getCustomer_email_address()." ";
        echo $this->obj->getCustomer_alias()." ";
        echo $this->obj->getCustomer_CS265_credit_card_account_number()." ";
        echo $this->obj->getCustomer_pin_password()." ";
        echo $this->obj->getCustomer_balance()." ";
        echo $this->obj->getCustomer_limit()." ";
    }

}


//--- testdrive in action

<?php

include ('TestDriver3.php');
$ok=new TestDriver3();
$ok->display_attributes();

?>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote