Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Form1.cs
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace OefeninfenLagenForms
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Berekenknop_Click(object sender, EventArgs e)
- {
- Business b1 = new Business();
- MessageBox.Show(Convert.ToString(b1.berekenTeBetalen(Convert.ToDouble(txtBedraginv.Text))));
- }
- }
- }
- Business.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OefeninfenLagenForms
- {
- class Business
- {
- private double bedrag;
- public double Bedrag
- {
- get { return bedrag; }
- set { bedrag = value; }
- }
- public double berekenTeBetalen(double pbedrag)
- {
- double korting = 0.0;
- if (pbedrag > 0)
- {
- if (pbedrag < 50)
- {
- korting = 0.025;
- }
- else if (pbedrag < 100)
- {
- korting = 0.05;
- }
- else if (pbedrag <200)
- {
- korting = 0.10;
- }
- else
- {
- korting = 0.20;
- }
- return pbedrag - (pbedrag * korting );
- }
- return 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment