You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Übungen_LF6_WinFormanwendung
|
|
|
|
|
{
|
|
|
|
|
class PrePaid
|
|
|
|
|
{
|
|
|
|
|
//Eigenschaften
|
|
|
|
|
public double EuroMByte { get ; set; }
|
|
|
|
|
public double EuroMinute { get; set; }
|
|
|
|
|
public double EuroSMS { get; set; }
|
|
|
|
|
public double guthaben { get; private set; }
|
|
|
|
|
|
|
|
|
|
//Methoden
|
|
|
|
|
|
|
|
|
|
public void aufladen(double neuesGuthaben)
|
|
|
|
|
{
|
|
|
|
|
if (neuesGuthaben < 15.0)
|
|
|
|
|
neuesGuthaben = 0;
|
|
|
|
|
|
|
|
|
|
guthaben += neuesGuthaben;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void verbrauchMByte(double verbrauchMByte)
|
|
|
|
|
{
|
|
|
|
|
if (guthaben != 0)
|
|
|
|
|
|
|
|
|
|
guthaben -= EuroMByte * verbrauchMByte;
|
|
|
|
|
|
|
|
|
|
if (guthaben < 0)
|
|
|
|
|
guthaben = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void verbrauchMinute(double verbrauchMinute)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (guthaben != 0)
|
|
|
|
|
|
|
|
|
|
guthaben -= EuroMinute * verbrauchMinute;
|
|
|
|
|
|
|
|
|
|
if (guthaben < 0)
|
|
|
|
|
guthaben = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public void verbrauchSMS()
|
|
|
|
|
{
|
|
|
|
|
if (guthaben != 0)
|
|
|
|
|
{
|
|
|
|
|
guthaben -= EuroSMS;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Konstruktoren
|
|
|
|
|
public PrePaid()
|
|
|
|
|
{
|
|
|
|
|
EuroMByte = 0;
|
|
|
|
|
EuroMinute = 0;
|
|
|
|
|
EuroSMS = 0;
|
|
|
|
|
guthaben = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PrePaid(double neuEuroMByte, double neuEuroMinute, double neuEuroSMS, double neuguthaben)
|
|
|
|
|
{
|
|
|
|
|
EuroMByte = neuEuroMByte;
|
|
|
|
|
EuroMinute = neuEuroMinute;
|
|
|
|
|
EuroSMS = neuEuroSMS;
|
|
|
|
|
guthaben = neuguthaben;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|