Create a method in the customer class file

Assignment Help Programming Languages
Reference no: EM131324070

Creating Methods

Since you have created the data objects for Harbor View Mooring, you now need to create processes associated with each object. In order to keep with good object-oriented practices of implementation hiding and program modularization, all processes related to an object (class) must be kept in a discreet method, within the object's Class definition file. So, your job is to create Methods that accomplish the following tasks.

Assumption: Each customer will only be owner of one boat and will only rent one slip.

You are expected to follow the "General Directions" found in the "Course Project Instructions" link on our course page.

Customer Class:

(1) Use the Customer class and array you created. (See Note #1 in Programming Notes below.)

(2) Create a Method in the Customer Class file that will sort the Customers by ID number when called from the main program. To do this, you will need to use an Interface (using the iComparable method) as described in the programming notes below. (See Note #2 in Programming Notes below.)
Boat Class:

(1) Use the Boat class and array you created in Unit 3.

(2) Each year, a customer must pay an insurance premium to HVM based on a fixed amount (determined by HVM) and the value of their boat. Create a Method in the Boat Class file called, "BoatInsurance". This Method will receive a fixed amount and a percentage (floating point number) as parameters (input by the user) and will return the insurance premium due from the owner of this boat. (The insurance premium is the fixed amount plus the percentage of the boat's value; the fixed amount and percentage are both supplied by the user.) In keeping with the OO principles of Abstraction and Reusability, this Method will be in the Boat Class file.

Slip Class:

(1) Use the Slip class and array you created in Unit 3.

The following tasks need to be demonstrated using the Methods you have created:

• Use the Interface you created in the Customer class to sort the customers by ID number.

• Print Customer information about each customer in sorted order. You can either print all information (fields), or print customer ID, last name, first name, boat number, and slip number (excluding address and phone number).

• Continuously prompt the user for a customer number; while user enters a valid customer number, present customer name, boat ID, and slip ID. Tell the user if they enter an invalid customer ID. Continue prompting the user until they indicate they are finished.

o Prompt the user for a boat ID;

o if the boat ID is valid, return the value of the boat (using "getter" Methods from the Boat class). (See Note #3 in Programming Notes below.) and

o ask the user if they want to calculate the yearly boat insurance premium;

o if they do, prompt them for a fixed amount and a percentage, and then return the insurance premium amount. (For this task you should use the BoatInsurance method from the Boat class.)

o Print out the insurance premium amount.

o (If they enter an invalid boat ID, inform them of such.)

o (No need to prompt the user for more boat IDs; just demonstrate this function once in your program; i.e. only ask for one boat ID, then continue on in the program.)

• Prompt the user for a slip ID;

o if the slip ID exists, return the slip's monthly rental amount,

o and tell whether the slip is rented or not (using "getter" Methods from the Slip class). (See Note #3 in Programming Notes below.)

o Ask the user if they want to change the monthly slip rental amount; if they do, then prompt them for the amount and update the slip rental amount (using "setter" Methods from the Slip class).

o Print all the new slip information (at least slip ID and rental amount) to verify to the user that the slip rental amount was updated. (No need to prompt the user for more slip IDs; just demonstrate this function once in your program; i.e. only ask for one slip ID, then continue on in the program.)

o (If they enter an invalid slip ID, inform them of such.)

o (No need to prompt the user for more slip IDs; just demonstrate this function once in your program; i.e. only ask for one slip ID, then continue on in the program.)

o No need to do advanced error checking; for this exercise we will assume that if the customer exists, then the slip and boat numbers also exist, even though in real life this might cause our program to encounter errors.

Programming Notes:

1. Because you are using the same Classes you created (and will be instantiating your objects with data you have already created), you should copy your Visual Studio solution to create your Project. You can then add Methods to your Class files.

2. For sorting "objects" by ID, you need to create an Interface using the iComparable.CompareTo() method in the Class file as explained on page 286 ff. (This same process could be used to sort by name or by any other field.)

3. In order to access elements of an object individually, you will need to assign "getters" and "setters", and set their protection levels properly. Consider using the auto-implemented property as explained on pp. 256-259.

Deliverables:

• A customer Class file with indicated Methods defined.
• A boat Class file with indicated Methods defined.
• A slip Class file with indicated Methods defined.
• A main C# test program that carries out the processes indicated above.

Upload Instructions:

Select the Add Submission button below. Click Add, located in the top left hand corner of the File Submission box. The File Picker window will appear. Click Upload a file and then select the Browse button. Navigate to your file location. Once the file is located, select it and then select the Open button, the Upload this file button, and then the Save changes button.

Reference no: EM131324070

Questions Cloud

Construct the ipr curve at the currentaverage pressure : A well is producing from a saturated oilreservoir with an average reservoir pressureof 3000 psig. Stabilized flow test dataindicates that the well is capable of producing400 STB/day at a bottom-holeflowing pressure of 2580 psig.
Identify any arbitrage and explain how it would be captured : Suppose you observe a one-year futures price of $100,- If the futures option call price is quoted at $9.40, identify any arbitrage and explain how it would be captured.
Describe resources that will be needed for supporting system : Describe the resources that will be needed for supporting the system during the startup period. Define ongoing system maintenance roles and responsibilities (Corrective, Adaptive, Protective, Preventive).
Calculate the price of the put described in problem : Using the information in the previous problem, calculate the price of the put described in problem, using the Black model for pricing puts.
Create a method in the customer class file : Create a Method in the Customer Class file that will sort the Customers by ID number when called from the main program. To do this, you will need to use an Interface as described in the programming notes below.
Identify and define three versions of put call parity : Using the Black-Scholes-Merton option pricing model and the generic carry formula for forward contracts (using continuous compounding), demonstrate that Ce(S0,T,X) = Ce(f0(T),T,X).
Prepare a plan to implement your choice : Prepare a case analysis for Case 1 and answer question 1/prepare diagram at the end of case 1 (include as an appendix to the case)
What is the cost of preferred stock : Suppose we have a bond issue currently outstanding that has 25 years left to maturity. The coupon rate is 9% and coupons are paid semiannually. The bond is currently selling for $908.72 per $1000 bond. What is the cost of debt? Your company has prefe..
Market risk premium-what is our cost of equity : Suppose our company has a beta of 1.5. The market risk premium is expected to be 9% and the current risk-free rate is 6%. We have used analysts’ estimates to determine that the market believes our dividends will grow at 6% per year and our last divid..

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a program that prompts a user to enter names of colors

Write a program that prompts a user to enter the names of two primary colors to mix, If the user enters anything other than "red", "blue",or yellow", the program should display an error message.

  Create database tables in sql

List the SQL commands you will use to create your database tables

  Find out probability at any given time user transmitting

Assume there are 20 users. Determine probability that at any given time, exactly n users are transmitting simultaneously. Determine the probability that there are 11 or more users transmitting simultaneously.

  Prepare a function that generates a polynomial

Write a function genPoly(n) that generates a polynomial of length n (degree n-1), all of whose coefficients are 1.0.

  Design program that asks user to enter budgeted amount

"Design a program that asks the user to enter the amount that he or she has budgeted for a month. (For example: $2,000.00)

  Creating printstream object using dos

Create a PrintStream object using dos and assign the resulting reference to ps, a PrintStream variable that has already been declared.

  Compare using link labeles method

Just to make labels and scores for original graph and its done once for the comparison reasons - refine the Removed graph to take only edges that don't exist (missing and nonexistent) with there link labels

  Modify name field on your isp form so that is now text field

Modify the Name field on your ISP form so that is now two text fields - one for ‘First Name and one for ‘Last Name'. The second password field should be labeled "Confirm Password".

  Write loop which processes pay for all workers in array

Print program titles and report headings, then call input function described next to fill in data array. Write loop which processes pay for all workers in array.

  Create an xml document that marks up nutrition facts

Create an XML document that marks up the nutrition facts for a package of Grandma White's cookies. A package of cookies has a serving size of 1 package.

  Program to compute person earns in a month

Write a program that calculates how much a person earns in a month if the salary is one penny the first day, two pennies the second day, four pennies the third day.

  Explaining law of diminishing returns

As computer word size gets larger and larger, there is a law of diminishing returns; speed of execution of application programs doesn't increase and may, in fact, decrease.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd