Laboratory Exercises in Visual CSharp - Lab6 To Lab8

You might also like

Download as pdf
Download as pdf
You are on page 1of 7
OBJECT ORIENTED PROGRAM ING, LABORATORY EXERCISE NO. 6 OBJECTIVE: Be able to apply basic concepts in Timer, PictureBox, and CheckBox PROBLEM: Create an application that will facilitate the payment in 2 dental clinic. There are 3 basic services offered and the user checks any of the following services. Afterwhich, the application should be able to display the amount to be paid by the client. DIRECTIONS: Construct the form found In the sample dialogue and Implement the given instructions below: 1 2. Ds 8. Create a new project (Windows Application). Save the project as pe#_act6, example: pe12_act6. Insert all the necessary components to complete the given form below. Insert 2 Label with the Text property as empty. Set the BorderStyle property a5 Fixed3D. To allow the current time to appear in this label, set the Name property as IblCurrentTime. Double click Timer [ES FRET from the Toolbox (Component Category) to insert it in the form. Notice that it is not situated in the boundaries of the form. This component is not really visible in the form. Double click it and insert the given code: IbICurrentTime.Text = String.Format(’ DateTime.Now); mm:ss tt Select the Timert and set the following properties to enable the timer to update the system time in every tick of a second: + Enabled: True + Interval: 1000 To insert a picture, copy the image puppy.jpg from the network folder. In case the picture Is not available, look for any pictures from My Documents as substitute. Click PictureBox [isil PictureBox trom the Toolbox and drag it in the form. Set the Size property of the image as 56, 44. Set the Image property by browsing the Image from your project folder. Set the SizeMode property to StretchImage. Click CheckBox in the toolbox and crag it in the form, Change the Name property to chkCleaning, chkCavity, and chkxRay respectively. Insert @ label where to display the amount to be paid. Set the Name property of the label as IblAmountDue. Set also the BorderStyle property as Fixed3D. Insert a Button and set the Name as btnCalculate, double click it and insert the given codes below //Test if checkbox is being selected if (txtPatientName.Text != "" && (chkCavity.Checked true II MR. EDMUND D. EVANGELISTA, University of Saint Louis Page 1 OBJECT ORIENTED PROGRAM ING, LABORATORY RCI chkCleaning.checked == true || chkxRay.Checked int intTotal = 0; if (chkCleaning.Checked intTotal += 250; if (chkCavity.Checked intTotal += 380; if (chkXRay.Checked == true) intTotal += 450; IblAmountDue.Text = "P" + String.Format("{0:F}", intTotal rue) true) else MessageBox.Show( 2 Insert a Button named es btnCancel, double click it and insert the given codes below: ‘txtPatientName.Text chkCavity.Checke chkCleaning.Checked = false; chkXRay.Checked = false; IblAmountDue.Text = "P0.00"; SAMPLE DIALOGUE: ar25PH Label (&® vovra. paumerr room pete ous a PictureBox Bi ewysang xa Oxny eam Amount due: [F000 CheckBox eed ® vara pavmext room EE cewea E covyrtng MR. EDMUND D. EVANGELISTA, University of Saint Louis Page 2 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISE NO. 7 OBJECTIVE: Be able to apply concepts on Properties, Behavior and Nested If PROBLEM: Develop an application that will compute the tax amount to be paid by vehicles in a toll gate. The computation Is based on the following: Vehicle Morning (AM) | Afternoon and Onwards (PM) Trailer P350 P500 Bus 320 P400 Cars/Jeeps | P210 P3680 Others P150 P200 There should only be one type of vehicle to be selected. If more than one vehicle is selected, a message “Invalid input for vehicle!” should pop up. Note: to get rid of writing additional codes - better use RadioButton instead of a CheckBox. DIRECTIONS: Construct the form found in the sample dialogue and implement the given instructions below: 1. Create a new project (Windows Application). Save the project as pe#_act7, example: pc12_act7. 2. Insert all the necessary components to complete the given form below. 3. In case you do not have the picture used in the application, look a substitute picture from My Documents folder. SAMPLE DIALOGUE: poe casaZzam TOLL GATE CENTER Tuguegsrso City, Cagayan Regen 2. Pitpoines Vehicle Code: |) Trlers MR. EDMUND D. EVANGELISTA, University of Saint Louis Page 1 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: EXERCISE NO. 8 OBJECTIVE: Creation of multiple forms PROBLEM: write an application that records all the repair and installation services made by a computer technician in all of the computers. The application should be able to provide a separate interface for PC Repair and Installation in which the details of the service is being recorded. DIRECTIONS: Construct the form found in the sample dialogue and implement the given instructions below: 1, Create a new project (Windows Application). Save the project as pe#_act8, example: pe12_act8. 2, Insert all the necessery components to complete the given form below. Roecaas 3. Set the Name properties of the controls given. + First textbox - txtIDNo + Second textbox = txtName + Third textbox - txtDepartment 4. Set the Modifiers property of the three textbox to Public. MR. EDMUND D. EVANGEL! TA, University of Saint Loui Page 1 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: a : Tl Winbatox is GenerateMenber Tut iF eesceden Tre toda here 13 tres Stein aay 1B exon ou tooo ieee 13 aon bas uomase oc tadenah 67 Bremne 0,0 CC tte » hive ase Peeerha feat sn 5. Create two additional forms and name it as Repair.cs and Installation.cs by following the given demonstrations below: ‘neta. (Desh) ESE This is the main project directory. The name varies depending on the project name used. be | Bl vrs ron il om cont 24) ae + Select Solution Explorer, right click on the root project folder (ex. pc12_acts) Select Add | New Item Select Windows Form and type Repair.cs as the filename. Page 2 MR. EDMUND D. EVANGELISTA, University of Saint Le OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: Tenge: sual tudo stalled templates aa45 48 6 Cae tance Coda Fla Wieder Uew Cat 52k Oatabace al 2 8 @ TetFly —Aucently Sepa Reeacae le Stir Fle MDI Put inl. Crh. 6. Repeat Step4 by creating another form. Set the filename as Installation.cs. ‘At this point, you should have created three different forms in your application. 7. Select Form1.cs and double click PC Repair button. Insert the given codes below: WF (et1ONo Text | tettuame.Text I txtDepartment.Text MessageBox.Show("Please complete the information|"); else 4 Repair r = new Repair(); roetRequest.Text = txtName Text; tetIONo.Clear(); ‘bxtName.Clear(); bxtDepartment Clear(); rebetRequest.Enabled = false; r-ShowDialog(); 8, Double click Installation button, Insert the given codes below: if (txtIDNo.Text == "" || txtName.Text || txtDepartment.Text == MessageBox,Show("Please complete the information!” else Installation i = new Installation(); itxtRequest.Text = ttName,Text; txtIDNo.Clear(); txtName Clear(); ‘txtDepartment.ClearQ); i.txtRequest Enabled = false; iShowDialog(); ¥ MR. EDMUND D. EVANGEL! "TA, University of Saint L Page 3 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: 9. Double click Exit button. Insert the given code: Application. Exit(); 10,Select Repair.cs and create the given interface below: one 11.Double click the OK button. Insert the code: if(txtDetails.Text=="" || txtRemarks.Text MessageBox Show("Please complete the information|"); else this.CloseQ); 12. Double click the Cancel button, Insert the given codes below: txtDetails.Clear(); txtRemarks.Clear(); 13.Set the Modifiers property of the three textbox to Public. 14.Select Installation.cs and complete the given controls below: eee Enabled: False 15.Set the Modifiers property of the three textbox to Public. 16.Double click the OK button. Insert the code: if(txtReason Text=="" || txtRequest.Text=="" || bxtSoftware, Text MessageBox.Show("Please complete the information!” else this.Close(); 17.Double click the Cancel button, Insert the given codes below: txtRequest.Clear(); txtSoftware.Clear(); txtReason.Clear(); 18.Run your application. MR. EDMUND D. EVANGELISTA, University of Saint Loui Page 4

You might also like