Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Business.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Oef5p25KassaKorting
- {
- 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<50)
- {
- korting = 2.5;
- }
- else if (pbedrag<100)
- {
- korting = 5;
- }
- else if (pbedrag<200)
- {
- korting = 10;
- }
- else
- {
- korting = 20;
- }
- return pbedrag * (1 - korting / 100);
- }
- }
- }
- //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 Oef5p25KassaKorting
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btnBereken_Click(object sender, EventArgs e)
- {
- Business rekenen = new Business();
- rekenen.Bedrag = Convert.ToDouble(txtBedrag.Text);
- MessageBox.Show("Je betaalt " + rekenen.berekenTeBetalen(rekenen.Bedrag) + " euro");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment