Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Switch | Kontrolstrukturer
C# Grundlæggende

bookChallenge: Switch

Opgave

Swipe to start coding

Your task is to complete the PrintPlanDescription method so that it uses a switch statement to print the correct plan or day description based on the numeric code provided by the user.

  • If the code is 1, print "Basic Plan".
  • If the code is 2, print "Standard Plan".
  • If the code is 3, print "Premium Plan".
  • If the code is 4, print "Weekend".
  • If the code is 5, print "Holiday".
  • For any other code, print "Invalid code".

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 17
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

close

bookChallenge: Switch

Stryg for at vise menuen

Opgave

Swipe to start coding

Your task is to complete the PrintPlanDescription method so that it uses a switch statement to print the correct plan or day description based on the numeric code provided by the user.

  • If the code is 1, print "Basic Plan".
  • If the code is 2, print "Standard Plan".
  • If the code is 3, print "Premium Plan".
  • If the code is 4, print "Weekend".
  • If the code is 5, print "Holiday".
  • For any other code, print "Invalid code".

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 17
single

single

some-alt