Seksjon 6. Kapittel 9
single
Challenge: Scopes
Sveip for å vise menyen
Oppgave
Sveip for å begynne å kode
You want to calculate total sales for a day using local and global variables.
- Declare a global variable
grandTotal(outside any method) to store the total sales. - Create a method
AddSalethat:- Declares local variables
priceandquantity. - Calculates the total for that sale and adds it to the global
grandTotal.
- Declares local variables
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 6. Kapittel 9
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår