Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Scopes | Metodi
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Fondamenti di C#

bookChallenge: Scopes

Compito

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 AddSale that:
    • Declares local variables price and quantity.
    • Calculates the total for that sale and adds it to the global grandTotal.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 6. Capitolo 12
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

close

bookChallenge: Scopes

Scorri per mostrare il menu

Compito

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 AddSale that:
    • Declares local variables price and quantity.
    • Calculates the total for that sale and adds it to the global grandTotal.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 6. Capitolo 12
single

single

some-alt