hospital-charges

This lab relates to the following Skill Outcomes:

  • Students will apply the steps in the program development process
  • Students will implement object-oriented programming through predefined classes
  • Students will develop graphical user interface applications using appropriate controls
  • Students will implement primitive data types for variables and fields
  • Students will implement the selection structure
  • Students will select appropriate arithmetic and relational operators
  • Students will analyze, design, implement, test, and debug domain-specific applications which demonstrate basic computation, input/output, control structures, operators, input validation, and methods

This lab covers material from Chapter 6 as well as concepts from previous chapters. The purpose of this lab is to demonstrate the use of methods and method calls to pass arguments and assign parameters as well as to prevent data conversion exceptions and implement appropriate input validation. PLEASE READ THE INSTRUCTIONS CAREFULLY AS ADDITIONAL REQUIREMENTS ARE INCLUDED BEYOND THE TEXTBOOK PROBLEM STATEMENT.

1. Complete Programming Problem #6, Hospital Charges, on page 392 of the textbook.

You MUST also include the ADDITIONAL REQUIREMENTS below:

  • Prevent data conversion errors for ALL input text boxes using the appropriate TryParse method. If a data conversion error occurs, be sure and display an appropriate error message to the user, set the focus back to the text box with the error, and either clear the text box or select all the data entered into it so that it can be replaced. Remember best practice is to group validation for a text box control so that the user may not move on to the next text box until the current text box value is valid.
  • Validate input accuracy for the number of days greater than zero (i.e., the patient must stay at least one day) while all other input values must be greater than or equal to zero (i.e., these are optional charges). If not, be sure and display an appropriate error message to the user, set the focus back to the text box with the invalid date, and either clear the text box or select all the data entered into it so that it can be replaced. Remember best practice is to group validation for a text box control so that the user may not move on to the next text box until the current text box value is valid.
  • Additional Details for Creating Methods on page 392 and an additional method:
    • CalcStayCharges – should receive one argument representing the value of number of days and then calculates and returns the base charges for the hospital stay. This is computed as $350 times the number of days in the hospital (hint: avoid stale data by simply returning the results of the calculation). The return value should be assigned to a local variable in the Calculate button event handler and then displayed.
    • CalcMiscCharges – should receive four arguments representing the values of medication charges, amount of surgical charges, amount of lab fees, and physical rehabilitation charges and then calculates and returns the total of the medication, surgical, lab, and physical rehabilitation charges (hint: avoid stale data by simply returning the results of the calculation). The return value should be assigned to a local variable in the Calculate button event handler and then displayed.
    • CalcTotalCharges – should receive two arguments representing the value of the base charges for the hospital and the total of the miscellaneous charges (i.e., total of the medication, surgical, lab, and physical rehabilitation charges – hint: avoid stale data by simply returning the results of the calculation). The return value can either be assigned to a local variable in the Calculate button event handler and then displayed OR it can be returned and displayed directly in the output statement.
    • DisplayMembershipLevel – The hospital offers future discounts based upon membership level. Membership level is based upon total charges. The DisplayMembershipLevel method should receive one argument representing the value of total charges and determine the membership level based upon the following criteria:
      • Bronze – total charges between $1.00 and $999.99
      • Silver – total charges between $1,000.00 and $1499.99
      • Gold – total charges between $1500.00 and $1999.99
      • Platinum – total charges greater than or equal to $2000.00
    • The method should then return the value of the membership level as a string (i.e., “Bronze”, “Silver”, “Gold”, “Platinum”) and can either be assigned to a local variable in the Calculate button event handler and then displayed OR it can be returned and displayed directly in the output statement.
  • The design of the form is up to you, but must include the following controls:
    • Appropriately named text boxes for all input requirements with descriptive labels informing the user what to enter
    • Appropriately named output labels with currency formatting for the following:
      • Hospital Stay Charges
      • Miscellaneous Charges
      • Total Charges
    • Calculate button, with appropriate name and keyboard access key, which processes the input and output (assign to AcceptButton property)
    • Clear button, with appropriate name and keyboard access key, that will clear ALL the controls on the form (i.e., text boxes and output labels) and sets the focus to the first input text box (assign to CancelButton property)
    • Exit button, with appropriate name and keyboard access key, which closes the program

The program MUST include standard features of a Windows application including:

  • Change the default Text property of the form to something descriptive
  • Appropriate naming conventions for all controls (i.e., buttons, labels, text boxes, list)
  • Calculate, Clear, and Exit buttons with appropriate name and standard keyboard access key
  • AcceptButton and CancelButton properties should be appropriately assigned to the Calculate button and Clear button, respectively
  • Ensure tab order for form is logical
  • Appropriate naming conventions and data type declarations for variables and named constants
  • Remove all unused event handlers from the program code

2. Name your project using the naming convention provided in the syllabus: CourseNumber_LastNameFirstInitial_LabXX (e.g., 3333_SharpJ_Lab06)

3. Include the appropriate identification information per the course syllabus using comment statments at the top of your project code (see p. 102, 2.8 Comments, Blank Lines, and Indentation): Name, 9-Digit ID, Due Date, Date Submitted, and Brief Description of Program.

4. You will need to zip/compress the project folder using an appropriate zip/compression utility such as the one found in the Windows or WinZip, etc. Please DO NOT submit .rar (archive) files.

5. Attach and submit the zipped/compressed project folder file under the Lab 06 link under Assessments in the Chapter 6 Module.

6. See Revised Form based on Additional Requirements below. A PDF document with sample input-output is attached:

lab06HospitalCharges.JPG

Get 15% discount on your first order with us
Use the following coupon
FIRST15

Order Now