Thema: Delphi Pizzaservice

Einzelnen Beitrag anzeigen

cobralord

Registriert seit: 9. Nov 2006
23 Beiträge
 
#14

Re: Pizzaservice

  Alt 4. Dez 2006, 15:05
Hallo,
den Preis für den Belag der Pizza kann ich jetzt ausrechnen und den Code für die Größe habe ich auch schon geschrieben. Es funktioniert ohne Probleme, allerdings zeigt das Programm bei jeder Pizzagröße 0€ an, obwohl ich sie oben deffiniert habe. Trotz halbstündiger Fehlersuche habe ich aber nichts gefunden was gewirkt hat.
Der Code ist:


Delphi-Quellcode:
var
  Form1: TForm1;
const Salami=1 ; Käse=0.8 ; Schinken=1.2 ; Ananas=1.3 ; Sardellen=1.5 ;
 Klein=1.5 ; Groß=2 ; Riesen=2.7 ; Family=3.5;
var Preis : double;


implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

begin

if checkbox1.checked then Preis := Preis + Salami
else Preis := Preis + 0;
label1.Caption:='Der momentane Preis ist ' + floattostr(Preis) + '';
if checkbox2.checked then Preis := Preis + Käse
else Preis:=Preis + 0;
label1.caption:='Der momentane Preis ist ' + floattostr(Preis) + '';
if checkbox3.checked then Preis := Preis + Schinken
else Preis := Preis + 0;
 label1.caption:='Der momentane Preis ist ' + floattostr(Preis) + '';
if checkbox4.checked then Preis := Preis + Ananas
else Preis := Preis + 0;
 label1.Caption:='Der momentane Preis ist ' + floattostr(Preis) + '';
if checkbox5.checked then Preis := Preis + Sardellen
else Preis := Preis + 0;
label1.caption:='Der momentane Preis ist ' + floattostr(Preis)+ '';

if radiogroup1.itemindex = 0 then begin
Preis := Preis + Klein;
label1.caption:='Der momentane Preis ist' + floattostr(Preis) + '';
end;
if radiogroup1.itemindex = 1 then    begin
Preis := Preis + Groß;
label1.caption:='Der momentane Preis ist' + floattostr(Preis) + '';
            end;
if radiogroup1.itemindex = 2 then    begin
Preis := Preis + Riesen;
label1.caption:='Der momentane Preis ist' + floattostr(Preis) + '';
            end;
if radiogroup1.itemindex = 3 then    begin
Preis := Preis + Family;
label1.caption:='Der momentane Preis ist' + floattostr(Preis) + '';
            end;



end;




end.

Bitte helft mir!!!
  Mit Zitat antworten Zitat