BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

C#代写 | ISCG6421 – GUI Programming Assignment 1

C#代写 | ISCG6421 – GUI Programming Assignment 1

C#开发一家汽车维修公司的业务管理系统

Assignment objectives:

There are two objectives for this assignment:

  1. To demonstrate the use of the C# language for the creation of an effective database front end by developing forms which:
    1. Visually present database information.
    2. Demonstrate appropriate user and programmatic navigation.
    3. Allow the user to enter new data and change existing data.
  2. To demonstrate the testing, debugging and documentation of a C# application by:
    1. Using the available debugging tools to debug a program.
    2. Developing test cases appropriate to a GUI approach.

 

Introduction

This assignment is based on a case study about Green’s Garage, a vehicle maintenance company. Green’s Garage is a business that provides servicing to privately owned motor vehicles. The company requires a front end application for their database which has already been developed.  You, the programmer, have to complete the work by writing an application, in the language C#, which will allow the users to maintain the records stored in the database and produce the report that they need.

 

Database

 

You are provided with an MS Access database for this assignment named Green. Please leave the structure of this database as it is and not add any tables or queries. The Green’s Garage database has the following tables:

 

OWNER (OwnerID, LastName, FirstName, Street Address, Suburb, PhoneNumber)

SERVICETYPE (ServiceTypeID, Description, HourlyRate)

VEHICLE (VehicleID, PlateNumber, Make, Model, OwnerID*)

SERVICE (VehicleID*, ServiceTypeID*, Hours, ServiceDate, Status)

EQUIPMENT (EquipmentID, Description)

SERVICETYPE EQUIPMENT (ServiceTypeID*, EquipmentID*)

 

Note that the primary keys are underlined and foreign keys are indicated by a ‘*’ symbol.

 

Guide to the Assignment

 

  • You are to write the code for Assignment 1 in C# using Visual Studio .NET Community 2015

 

  • You are to use the OleDb objects to interact with the MS Access database tables.

 

  • Make sure that your C# project database connection points to c:\temp and make sure the MS Access database file is placed in c:\temp

 

  • You are to use the shared dataset model (see the SharedData and GlendeneCatCare projects, as discussed in class, and notes on databases in C#).

 

  • You are to use programming logic (master-detail relationships in conjunction with ‘for-each’ loops) to create the report – please do not use Crystal Reports.

 

  • Your interface should conform to the standards discussed in class and must match the screen designs provided in this document – please note the interface in GlendeneCatCare has limitations and should be used as a starting point but not as an exemplar.

 

  • Use the metadata provided in MS Access database tables as the data dictionary from which you can make decisions on what is valid or invalid data.

 

  • Your test cases must include all of the tests that as listed as required in the assignment document and your tests must be repeatable and independent. You may use the data in the MS Access tables as the basis for your loaded test data.
    • Select your input test data to make your tests as independent as possible. For example: if you are testing that a program deletes a vehicle record then use, as test data, a vehicle that exists in the loaded test data NOT a vehicle that was input in an earlier test.
    • Remember to verify the expected results of the tests with other tests if possible. For example, if you have a test that adds a new record, then use the ‘view’ facility in the program to check that the record has been added.
    • The numbering of your tests MUST correspond with the numbers in this document. If you create your interface so that a test is redundant (e.g. you use radio buttons for selection) you must still include the test in your test cases along with an explanation as to why it is redundant. Check all instances of this circumstance with the lecturer.

 

Test Cases

Please using the following format for your test cases

 

Requirement to test Test Data Input Expected Outcomes Actual Outcomes
       

 

Secondary Deadline Date

 

Please note that there is a secondary deadline date, 8:30 a.m. on Monday 5th September 2016 one week prior to the due date. Please make sure that you ask any questions regarding the assignment before this date.
Application Requirements

 

Write a Windows application in C# that allows the user to do the tasks specified below and to provide reasonably comprehensive testing documentation that proves that the application performs all of the tasks. Please note that these requirements are non-negotiable.

 

Task 1: Main Menu

  • This task allows the user to access all the forms and the report in the system and exit the application.
  • When run, this task will create a data module object (containing the OleDb objects used with the MS Access database tables) the address of which will be passed on to all the other forms via a parameter.

 

Required tests:

 

  • Main menu is displayed when the program is run.
  • Display owner maintenance form when the owner maintenance button is clicked.
  • Display service type maintenance form when the service type maintenance button is clicked.
  • Display equipment maintenance form when the equipment maintenance button is clicked.
  • Display vehicle maintenance form when the vehicle maintenance button is clicked.
  • Display service maintenance form when the service maintenance button is clicked.
  • Display equipment allocation form when the equipment allocation button is clicked.
  • Display the report “Invoices” form when the report “Invoices” button is clicked.

 

 

 

Task 2: Report “Invoices”

  • This must allow the user to print (on a print form) a report called ‘Invoices’ that shows the owner ID, full name, full address, all vehicle details, service type description, hourly rate, service hours, service date, all items of equipment used and gross due of each pending service.  The gross due of a service is the hours multiplied by the hourly rate of the service type. All currency values must be formatted (e.g. 10 must be shown as $10.00 and right-justified). One service per page. Please note that Crystal Report is NOT to be used for this task and the report is to be produced using Master-Detail relationships in conjunction with ‘for-each’ loops. Please find below the logic that produces a display version this report – this logic needs to be adapted for producing the printed report:

 

LOOP FOR EACH Service in the SERVICE table

IF the Service is ‘Pending’ THEN

GET the Vehicle for the Service

GET the Owner for the Vehicle

GET the Service Type for the Service

OUTPUT Owner details (Owner ID, last name, first name, street address, and suburb)

OUTPUT Vehicle details (plate number, make and model)

OUTPUT Service details (service type description, hourly rate, service hours and service date)

Gross Due := Service Hours * Service Type Hourly Rate

Get the Service Type Equipment for the Service Type

If the Service has Service Type Equipment THEN

LOOP FOR EACH Service Type Equipment

GET the Equipment for the Service Type Equipment

OUTPUT Equipment details (Description)

END LOOP

Output Gross Due

END IF

END IF

END LOOP

 

Required tests:

 

    • Produce the report with all requested fields present, correct calculations and for pending services only.

 

 

Task 3: Owner Maintenance

 

  • Display the owners’ names in a list.
  • Allows the user to navigate between owners in the list.
  • Display a selected owner’s details in a read-only format.
  • If the user clicks on the Add Owner button then
    • The Previous, Next, Return, Update Owner and Delete Owner buttons are disabled and the list should disappear.
    • A panel should appear (showing Save Owner and Cancel buttons) allowing the user to enter values for the new owner’s last name, first name, street address, suburb, and phone number.
    • If the user enters valid data for all fields and clicks on the Save Owner button then a new owner record is saved in the database and the message “Owner added successfully” is displayed.
    • If the user clicks on the Cancel button then panel should disappear, the Previous, Next, Return, Update Owner and Delete Owner buttons enabled and the list should reappear.
  • If the user clicks on the Update Owner button then
    • The Previous, Next, Return, Add Owner and Delete Owner buttons are disabled and the list should disappear.
    • A panel should appear (showing Save Changes and Cancel buttons) allowing the user to change the values for the owner’s last name, first name, street address, suburb, or phone number.
    • If the user makes valid changes to any of the allowable fields and clicks on the Save Changes button then the owner record is updated in the database and the message “Owner updated successfully” is displayed.
    • If the user clicks on the Cancel button then the panel should disappear, the Previous, Next, Return, Add Owner and Delete Owner buttons should be enabled and the list should reappear.
  • If the user clicks on the Delete Owner button and the selected owner has no vehicles then the user is asked to confirm the deletion – if the user confirms the deletion then the owner is deleted from the database and the message “Owner deleted successfully” is displayed.
  • If the user clicks on the Delete Owner button and the selected owner has vehicles then the error message “You may only delete Owners who have no vehicles” is displayed.
  • If the user clicks on the Return button then focus is returned to the Main Menu.

 

Required tests:

 

    • Add a new owner with valid data in all fields.
    • Update an existing owner’s last name with valid data.
    • Update an existing owner’s first name with valid data.
    • Update an existing owner’s street address with valid data.
    • Update an existing owner’s suburb with valid data.
    • Update an existing owner’s phone number with valid data.
    • Delete an existing owner who has no vehicles.
    • Attempt to add a new owner with an invalid last name but with valid data in all other fields.
    • Attempt to add a new owner with an invalid first name but with valid data in all other fields.
    • Attempt to add a new owner with an invalid street address but with valid data in all other fields.
    • Attempt to add a new owner with an invalid suburb but with valid data in all other fields.
    • Attempt to add a new owner with an invalid phone number name but with valid data in all other fields.
    • Attempt to update an existing owner with an invalid last name.
    • Attempt to update an existing owner with an invalid phone number.
    • Attempt to delete an existing owner who has vehicles.

 

 

 

Task 4: Service Type Maintenance

 

  • Display the service types’ descriptions in a list.
  • Allows the user to navigate between service types in the list.
  • Display a selected service type’s details in a read-only format.
  • If the user clicks on the Add Service Type button then
    • The Previous, Next, Return, Update Service Type and Delete Service Type buttons are disabled and the list should disappear.
    • A panel should appear (showing Save Service Type and Cancel buttons) allowing the user to enter values for the new service type’s description and hourly rate.
    • If the user enters valid data for all fields and clicks on the Save Service Type button then a new service type record is saved in the database and the message “Service type added successfully” is displayed.
    • If the user clicks on the Cancel button then the panel should disappear, and the Previous, Next, Return, Update Service Type and Delete Service Type buttons enabled and the list should reappear.
  • If the user clicks on the Update Service Type button then
    • The Previous, Next, Return, Add Service Type and Delete Service Type buttons are disabled and the list should disappear.
    • A panel should appear (showing Save Changes and Cancel buttons) allowing the user to change the values for the service type’s description and hourly rate.
    • If the user makes valid changes to any of the allowable fields and clicks on the Save Changes button then the service type record is updated in the database and the message “Service type updated successfully” is displayed.
    • If the user clicks on the Cancel button then panel should disappear, the Previous, Next, Return, Add Service Type and Delete Service Type buttons enabled and the list should disappear.
  • If the user clicks on the Delete Service Type button and the selected service type has no services or equipment then the user is asked to confirm the deletion – if the user confirms the deletion then the service type record is deleted from the database and the message “Service type deleted successfully” is displayed.
  • If the user clicks on the Delete Service Type button and the selected service type has services then the error message “You may only delete Service Types that are not assigned to services” is displayed.
  • If the user clicks on the Delete Service Type button and the selected service type has equipment then the error message “You may only delete Service Types who are not allocated equipment” is displayed.
  • If the user clicks on the Return button then focus is returned to the Main Menu.

 

Required tests:

 

    • Add a new service type with valid data in all fields
    • Update an existing service type’s description with valid data
    • Update an existing service type’s hourly rate with valid data
    • Delete an existing service type that has no services and no equipment allocated
    • Attempt to add a new service type with an invalid description but with valid data in all other fields
    • Attempt to add a new service type with an invalid hourly rate but with valid data in all other fields
    • Attempt to Update an existing service type with an invalid description
    • Attempt to Update an existing service type with an invalid hourly rate
    • Attempt to delete an existing service type that has services but no equipment
    • Attempt to delete an existing service type that has equipment but no services

 

Task 5: Equipment Maintenance

 

  • Display the descriptions of the items of equipment in a list.
  • Allows the user to navigate between items of equipment in the list.
  • Display a selected item of equipment’s details in a read-only format.
  • If the user clicks on the Add Equipment button then
    • The Previous, Next, Return, Update Equipment and Delete Equipment buttons are disabled and the list should disappear.
    • A panel should appear (showing Save Equipment and Cancel buttons) allowing the user to enter a value for the new item of equipment’s description.
    • If the user enters valid data for the description and clicks on the Save Equipment button then a new Equipment record is saved in the database and the message “Item of equipment added successfully” is displayed.
    • If the user clicks on the Cancel button then the panel should disappear, the Previous, Next, Return, Update Equipment and Delete Equipment buttons enabled and the list should reappear.
  • If the user clicks on the Update Equipment button then
    • The Previous, Next, Return, Add Equipment and Delete Equipment buttons are disabled and the list should disappear.
    • A panel should appear (showing Save Changes and Cancel buttons) allowing the user to change the value for the item of equipment’s description.
    • If the user makes valid changes to the description and clicks on the Save Changes button then the item of equipment record is updated in the database and the message “Item of equipment updated successfully” is displayed.
    • If the user clicks on the Cancel button then panel should disappear, the Previous, Next, Add Equipment and Delete Equipment buttons enabled and the list made visible.
  • If the user clicks on the Delete Equipment button and the selected item of equipment is not allocated to a service type then the user is asked to confirm the deletion – if the user confirms the deletion then the Equipment record is deleted from the database and the message “Item of equipment deleted successfully” is displayed
  • If the user clicks on the Delete Equipment button and the selected item of equipment is allocated to a service type then the error message “You may only delete equipment that is not allocated to a service type” is displayed
  • If the user clicks on the Return button then focus is returned to the Main Menu.

 

Required tests:

 

    • Add a new item of equipment with valid data in all fields
    • Update an existing item of equipment description with valid data
    • Delete an existing item of equipment that is not allocated to a service type
    • Attempt to add new item of equipment with an invalid description
    • Attempt to update existing item of equipment description with invalid data
    • Attempt to delete an existing item of equipment that is allocated to a service type

 

 

 

 

Task 6: Vehicle Maintenance

 

  • Display the vehicles’ plate numbers in a list.
  • Allows the user to navigate between vehicles in the list.
  • Display a selected vehicle’s details (along with the owner’s full name) in a read-only format.
  • If the user clicks on the Add Vehicle button then
    • The Previous, Next, Return, Update Vehicle and Delete Vehicle buttons are disabled and the list should disappear.
    • A panel should appear (showing Save Vehicle and Cancel buttons) allowing the user to enter values for the new vehicle’s plate number, make, model and owner (using a combo box).
    • If the user enters valid data for all fields and clicks on the Save Vehicle button then a new vehicle record is saved in the database and the message “Vehicle added successfully” is displayed.
    • If the user clicks on the Cancel button then the panel should disappear, the Previous, Next, Return, Update Vehicle and Delete Vehicle buttons enabled and the list should reappear.
  • If the user clicks on the Update Vehicle button then
    • The Previous, Next, Return, Add Vehicle and Delete Vehicle buttons are disabled and the list should disappear.
    • A panel should appear (showing Save Changes and Cancel buttons) allowing the user to change the values for the vehicle’s plate number, make or model.
    • If the user makes valid changes to any of the allowable fields and clicks on the Save Changes Vehicle button then the vehicle record is updated in the database and the message “Vehicle updated successfully” is displayed.
    • If the user clicks on the Cancel button then panel should disappear, the Previous, Next, Return, Add Vehicle and Delete Vehicle buttons enabled and the list should reappear.
  • If the user clicks on the Delete Vehicle button and the selected vehicle has no services then the user is asked to confirm the deletion – if the user confirms the deletion then the vehicle record is deleted from the database and the message “Vehicle deleted successfully” is displayed.
  • If the user clicks on the Delete Vehicle button and the selected vehicle has services then the error message “You may only delete vehicles that do not have services” is displayed.
  • If the user clicks on the Return button then focus is returned to the Main Menu.

 

Required tests:

 

    • Add a new vehicle with valid data in all fields.
    • Update an existing vehicle’s plate number with valid data.
    • Update an existing vehicle’s make with valid data.
    • Update an existing vehicle’s model with valid data.
    • Delete an existing vehicle that has no services.
    • Attempt to add a new vehicle with an invalid plate number but with valid data in all other fields.
    • Attempt to add a new vehicle with an invalid make but with valid data in all other fields.
    • Attempt to add a new vehicle with an invalid model but with valid data in all other fields.
    • Attempt to delete an existing vehicle that has services.

 

Task 6: Service Maintenance

 

  • Display the services’ details (vehicle id, service type id, hours, service date and status) in a data grid view.
  • Allows the user to navigate between services.
  • Display a selected service’s vehicle details (plate number, full name of owner) and service type details (description and hourly rate) in a read-only format.
  • If the user clicks on the Add Service button then
    • The Previous, Next, Return, Mark Service as Paid, Update Service and Delete Service buttons are disabled and the data grid view should disappear.
    • A panel should appear (showing Save Service and Cancel buttons) allowing the user to enter values for the new service’s vehicle (using a combo box), service type (using a combo box), hours and date (using a date picker). All new services are to have a status of pending.
    • If the user enters valid data for all fields and clicks on the Save Service button then a new service record is saved in the database and the message “Service added successfully” is displayed.
    • If the user clicks on the Cancel button then the panel should disappear and the Previous, Next, Return, Mark Service as Paid, Update Service and Delete Service buttons enabled and the data grid view should reappear.
  • If the user clicks on the Update Service button and the selected service has a status of pending then
    • The Previous, Next, Return, Mark Service as Paid, Add Service and Delete Service buttons are disabled and the data grid view disappear.
    • A panel should appear (showing Save Changes and Cancel buttons) allowing the user to change the values for the service’s hours or date (using a date picker).
    • If the user makes valid changes to any of the allowable fields and clicks on the Save Changes button then the service record is updated in the database and the message “Service updated successfully” is displayed.
    • If the user clicks on the Cancel button then panel should disappear, the Previous, Next, Return, Mark Service as Paid, Add Service and Delete Service buttons enabled and the data grid view should reappear.
  • If the user clicks on the Update Service button and the selected service has a status of paid then the message “Cannot update a paid service” is displayed.
  • If the user clicks on the Delete Service button and the selected service has a status of paid then the user is asked to confirm the deletion – if the user confirms the deletion then the service record is deleted from the database and the message “Service deleted successfully” is displayed.
  • If the user clicks on the Delete Service button and the selected Service has a status of pending then the error message “You may only delete paid services” is displayed.
  • If the user clicks on the Mark Service as Paid button and the selected service has a status of pending then the service’s status is changed to ‘paid’ in the database and the message “Service marked as paid” is displayed.
  • If the user clicks on the Mark Service as Paid button and the selected service has a status of paid then the error message “The Service is already paid” is displayed.
  • If the user clicks on the Return button then focus is returned to the Main Menu.

 

Required tests:

 

    • Add a new service with valid data in all fields.
    • Update an existing pending service’s hours with valid data.
    • Update an existing pending service’s date with valid data.
    • Mark as paid an existing pending service as paid.
    • Delete an existing paid service.
    • Attempt to update an existing pending service with an invalid hours.
    • Attempt to mark as paid a paid service.
    • Attempt to delete an existing pending service.

 

 

Task 8: Equipment Allocation

 

  • Display the service types’ details (id, description, hourly rate) in a data grid view.
  • Display the service type id and the ids of items of equipment already allocated to the selected service type in a data grid view.
  • Display the items of equipment details (id and description) in a data grid view.
  • Allows the user to navigate between service types in the data grid view.
  • If the user select an item of equipment and clicks on the Allocate Equipment button then
    • If the item of equipment is not already allocated to the service type then a new service type equipment record is saved in the database and the message “Item of equipment allocated successfully” is displayed.
    • If the item of equipment is already allocated to the service type then the error message “This item of equipment has already been allocated to this service type” is displayed.
  • If the user clicks on the Remove Equipment button then the user is asked to confirm the removal – if the user confirms the removal then the service type equipment record is deleted from the database and the message “Item of equipment removed successfully” is displayed.
  • If the user clicks on the Return button then focus is returned to the Main Menu.

 

Required tests:

 

    • Allocate an item of equipment (not already allocated) to a service type
    • Remove an item of equipment from a service type
    • Attempt to allocate an item of equipment to a service type that has already been allocated to that service type

 

 

 

 

Marking

 

It is expected that the code for each of the program tasks that you finish does not contain compilation errors (i.e. no marks will be awarded if the code does not compile).  Your application must update the database every time the user changes the data.  You are also expected to handle exceptions by using MessageBoxes and “try and catch” blocks.

 

Requirement Marks
Task 1: Main Menu 8
Task 2: Report “Invoices” 15
Task 3: Owner Maintenance 6
Task 4: Service Type Maintenance 5
Task 5: Equipment Maintenance 4
Task 6: Vehicle Maintenance 7
Task 7: Service Maintenance 12
Task 8: Equipment to Service Type Allocation 9
Testing Documentation 30
Naming conventions and correct internal documentation 4
Total: 100

 

Notes on marking

 

  • Marks will be deducted for any task that is either not fully functional or not tested adequately.
  • Check “Programming Standards for C Sharp Courses” at the end of this document. The standards for C# programming in this document MUST be followed. In particular this includes putting meaningful comments at the beginning of each and every method in the standard format as given in the document.

 

Do you want to do the best that you can do on this assignment and improve your grades?

You could:

  • Talk it over with your lecturer
  • Visit Te Puna Ako or Maia for learning advice and support
  • Visit the Centre for Pacific Development and Support
  • Contact the USU Advocate for independent advice
  • For contact details and more information, go to www.usu.co.nz

 

 

Deliverables

 

Soft Copy

 

The soft copy of the assignment is to be submitted in one *.zip (zip up your project while it is in the C:\Temp folder and please do not use any other formats such as .rar) file via Moodle (remember to click on the submit button) and is to include:

 

  • A soft copy of ALL files needed to compile and run your application from the Visual Studio .NET Community 2015 environment used in the Department of Computing labs. Please note that you must submit your assignment in Visual Studio .NET Community 2015. 30 marks will be deducted if this is not done. There is nothing to stop you from using other versions of Visual Studio .NET when working at home but please note that it is your responsibility to convert your assignment into Visual Studio .NET Community 2015  prior to submitting it (you are advised to test the conversion of your project on a regular basis).
  • Testing documentation.

 

Please note that it is important to upload the correct version of your assignment onto Moodle. If you submit the wrong version onto Moodle please notify me by email before the deadline date or late penalties may be incurred.

 

Demonstration

 

You will have the opportunity to demonstrate your program in class on Wednesday 14th September 2016.

 

User Interface

 

Always provide the users with clear instructions explaining what they should do. Areas used for input must be labelled to explain what input is required. Use hints or tool tips to explain interface features. The user must be prevented from entering values or taking actions that the program is unable to deal with. All input should be validated (use the MS Access database tables to see what is allowed in each field) and to see which fields are required); any errors found should be reported back to the user with an error message which clearly and politely explains how to correct the error. The user should be unable to proceed without correcting invalid input.

 

Assignment Delivery

 

Electronic submission of all of the necessary files is required for ALL assignments and must be submitted prior to 8:30am on the due date.  Assignments submitted after the due date and time without having received an extension through Special Assessment Circumstances (SAC) will be penalised according to the following:

  • 10% of marks deducted if submitted within 24hrs of the deadline
  • 20% of marks deducted if submitted after 24hrs and up to 48hrs of the deadline
  • 30% of marks deducted if submitted after 48hrs and up to 72hrs of the deadline
  • No grade will be awarded for an assignment that is submitted later than 72hrs after the deadline.

 

Special Assessment Circumstances

 

A student, who due to circumstances beyond his or her control, misses a test, final exam or an assignment deadline or considers his or her performance in a test, final exam or an assignment to have been adversely affected, should complete the Special Assessment Circumstances (SAC) form available from Student Central.

 

 

When requesting an SAC for an assignment, the SAC application form must be submitted (along with work completed to-date) within the time frame of the extension requested; i.e. if the Doctor’s certificate is for one (1) day, then the SAC application form and work completed must be submitted within one (1) day.

 

Assistance to other Students

 

Students themselves can be an excellent resource to assist the learning of fellow students, but there are issues that arise in assessments that relate to the type and amount of assistance given by students to other students.   It is important to recognise what types of assistance are beneficial to another’s learning and also what types of assistance are unacceptable in an assessment.

 

Beneficial Assistance

 

  • Study Groups.
  • Sharing reading material.
  • Testing another student’s programming work using the executable code and giving them the results of that testing.

Unacceptable Assistance

 

  • Working together on one copy of the assessment and submitting it as own work.
  • Giving another student your work.
  • Copying someone else’s work. This includes work done by someone not on the course.
  • Changing or correcting another student’s work.
  • Copying from books, Internet etc. and submitting it as own work. Anything taken directly from another source must be acknowledged correctly: show the source alongside the quotation.

 

 

Programming Standards for C Sharp Courses

Internal Documentation

 

  • Your code is such that other programmers can read it without struggling and your users are not left guessing as to what to do.
  • Each class file (including form classes) will begin with comments explaining the purpose of the class, the author and the date written.
  • Each method will start with comments that explain what the method does.
  • Any code which does not have an obvious meaning or which uses a specialized technique is to be commented. Use blank lines and further comments to identify where parts of a task begin within a method.
  • Code will use meaningful variable, class and method names. Components which have event handler code for any of their events must have meaningful names. Components which have properties assigned to in code must also have meaningful names. A naming convention that identifies the type of component involved is recommended. e.g. btnExit, txtStartDate, lblTotal

 

Layout

 

  • Code will be laid out in the style of the example below, using indentation steps of 4 spaces. Blocks using { and } will use the layout shown here:

 

    ///<Summary> method : btnLeapYear_Click

    ///Check if a date falls in a leap year

    ///</Summary>

private void btnLeapYear_Click(object sender, System.EventArgs e)

    {

        DateTime aDate = getDate();

        if ( DateTime.IsLeapYear(aDate.Year) )

        {

            label6.Text = aDate.Year.ToString() + ” IS a leap year”;

        }

        else

        {

            label6.Text = aDate.Year.ToString() 

+ ” is NOT a leap year”;

        }

    }

 

  • Parentheses and spaces will be used to make the meaning clear in arithmetic expressions and conditions:

        sum = (n1 / n2) + n3;

not

        sum = n1 / n2 + n3;

not

        sum=n1/n2+n3;

 

  • In general each method will perform a single simple task.
  • In the final version of your project please delete all sections of code that have been ‘commented out’
bestdaixie

评论已关闭。