Challenge: Scopes
Taak
Swipe to start coding
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
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 6. Hoofdstuk 12
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Geweldig!
Completion tarief verbeterd naar 1.25
Challenge: Scopes
Veeg om het menu te tonen
Taak
Swipe to start coding
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
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 6. Hoofdstuk 12
single