7. START P.A. 2 PERSONE DESCRIZIONE * ELAB 2 DESCRIZIONE EXIT Questo è il secondo ciclo! STAMPE FINALI *DESCRIZIONE= -1
8. ELAB 2 Q.P. P.U. TIPO * conta=conta+qp imp=p.u. *q.p * contb=contb+qp totimpb=totimpb+imp 2 1 * 3 4 Questo è il secondo ciclo con tutte le operazioni!! totimpa=totimpa+imp imp=p.u. *q.p
13. Tavolo Num persone Descrizione Quantità Prezzo unitario Tipo E ora comincia Visul Basic!! Questa è la Form!!
14. 'preparazione ambiente Public conta As Double Public contb As Double Public contc As Double Public contd As Double Public conte As Double Public perca As Double Public percb As Double Public percc As Double Public percd As Double Public perce As Double Public Max As Double Public totimpa As Double Public totimpb As Double Public totimpc As Double Public totimpd As Double Public totimpe As Double Public somquantità As Double Public somprezzo As Double Public conto As Double Public totincassato As Double Public coperto As Double Public C1 As Double Prima di cominciare con il linguaggio di visual Basic dobbiamo fare il modulo!!
15. Public Sub PA() conta = 0 contb = 0 contc = 0 contd = 0 conte = 0 perca = 0 percb = 0 percc = 0 percd = 0 perce = 0 Max = 0 Desc = 0 C1 = 1.5 totimpa = 0 totimpb = 0 totimpc = 0 totimpd = 0 totimpe = 0 totincassato = 0 somquantità = 0 coperto = 0 somprezzo = 0 End Sub La preparazione ambiente sempre nel modulo!!
16. Private Sub Cmdinizio_Click() While Txttavolo.Text <> -1 elab1 Txttavolo.Text = InputBox(" numero tavolo") Wend End Sub Private Sub elab1() npersone = Txtcomponenti.Text While Txtdescrizione.Text = "fine" elab2 Txtdescrizione.Text = InputBox("descrizione portata") Wend coperto = npersone * C1 stampefinali End Sub E ora il progetto!! Questi sono l’inizio e il primo ciclo di lavoro!!
17. Public Sub elab2() If Txttipo.Text = "A" Then conta = conta + Txtquantità.Text importo = Txtprezzo.Text * Txtquantità.Text totimpa = totimpa + importo Else If Txttipo.Text = "B" Then contb = contb + Txtquantità.Text importo = Txtprezzo.Text * Txtquantità.Text totimpb = totimpb + importo Else If Txttipo.Text = "C" Then contc = contc + Txtquantità.Text importo = Txtprezzo.Text * Txtquantità.Text totimpc = totimpc + importo Else If Txttipo.Text = "D" Then contd = contd + Txtquantità.Text importo = Txtprezzo.Text * Txtquantità.Text totimpd = totimpd + importo Else conte = conte + Txtquantità.Text importo = Txtprezzo.Text * Txtquantità.Text totimpe = totimpe + importo End If End If End If Il secondo ciclo e tutti i calcoli!!
18. End If somprezzo = somprezzo + Txtprezzo.Text somquantità = somquantità + Txtquantità.Text End Sub Public Sub stampefinali() perca = (conta * 100) / somquantità percb = (contb * 100) / somquantità percc = (contc * 100) / somquantità percd = (contd * 100) / somquantità perce = (conte * 100) / somquantità conto = (somquantità * somprezzo) + coperto Max = totimpa If totimpb > Max Then Max = totimpb Else End If If totimpc > Max Then Max = totimpc Else End If If totimpd > Max Then Max = totimpd Else End If Le stampe finali!!
19. If totimpe > Max Then Max = totimpe Else End If MsgBox conta MsgBox contb MsgBox contc MsgBox contd MsgBox conte MsgBox perca MsgBox percb MsgBox percc MsgBox percd MsgBox perce MsgBox Max MsgBox totimpa MsgBox totimpb MsgBox totimpc MsgBox totimpd MsgBox totimpe MsgBox conto MsgBox totincassato End Sub FINE ESERCIZIO!!