CA4 Object Oriented Programming C#

CA 4 Due  Friday 24 April 2020  C#

1. Write a class to represent a Customer.

The Customer class should have the following three attributes:

    A unique Customer ID number (int).
    Name (string)
    Account Balance (double)

    Use properties to enable access to the attributes.
    Provide getter and setter methods for each attribute.
    You can use the shortcut notation for properties {get;set;}.

The class should have 2 constructors:

(i)    A default constructor which sets a unique value for the Customer ID number. The Account Balance should be set to 0.

(ii)    A parameterised constructor, which should initialise the name and account balance. It should also set a unique value for the Customer number.

Provide a virtual method called AddCharge which takes an amount charged as a parameter and subtracts it from the account balance. The method should return true to indicate that the account has been charged.

Provide a ToString() method  to return the following values as a string:

ID Number          Name         Money owed       

In the main program:

(i)    Declare and create a customer object, customer1.
(ii)    Set the name to Mandy.
(iii)    Write the details to the console.
(iv)    Declare and create a customer object, customer2 with the name Jimmy using the parameterised constructor.
(v)    Add a charge of 500.
(vi)    Write the details to the console.

2.  Inheritance

Create a class for a TrialCustomer that inherits the features of the Customer class and also has the attribute:

Maximum Credit Available (double).

Constructors
The class should have 2 constructors:
(i)    A default constructor, calling the parent class default constructor. The Maximum Credit Available should be set to 0.
(ii)    A parameterised constructor to set Name, and Maximum Credit Available. The name should be passed back to the parent class constructor.

Methods

(i)    Provide an override  method for AddCharge which takes an amount charged as a parameter.
(ii)    If there is sufficient credit available,it subtracts the amount from the account balance. The method should return true if successful, false if insufficient credit.
(creditAvailable =AccountBalance+MaximumCreditAllowed)

(ii) Provide a ToString() method  to return the following values as a string:

ID Number          Name         Money owed        Credit allowed.   

4. Testing your Class in the Main Program – you can add to the existing main.

(i)    Declare and create a TrialCustomer object, trialCustomer1.
(ii)    Set the Name to Anastasia.
(iii)    Set the Maximum Credit Allowed to 1000.
(iv)    Write the details to the console.
(v)    Add a charge of 500
(vi)    Write the details to the console.

(vii)    Declare and create a TrialCustomer object, TrialCustomer2 with the name Maximilian and a Maximum Credit of 500, using the parameterised constructor.
(viii)    Write the details to the console.
(ix)    Add a charge of 700 and check if allowed.
(x)    Write the details to the console.

(xi)    Create an array of 5 Customer objects.
(xii)    Read in details from the provided file customers.txt
Each line has two or three fields:
name, account balance, max credit (if  a trial customer)
(xiii)    Create a Customer or TrialCustomer object from each line in the file. (hint: if 2 fields create a customer, if 3 create a trial customer).
(xiv)    Use a loop to print out the details of all the objects to the console.

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational