This lab relates to the following Skill Outcomes:
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:
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.99Silver – total charges between $1,000.00 and $1499.99Gold – total charges between $1500.00 and $1999.99Platinum – total charges greater than or equal to $2000.00The 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 enterAppropriately named output labels with currency formatting for the following:Hospital Stay ChargesMiscellaneous ChargesTotal ChargesCalculate 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:
Appropriate naming conventions for all controls (i.e., buttons, labels, text boxes, list)
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 tozip/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:
Lab 06 – Sample Input-Output