Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Praxis: Methoden | Einführung in die Objektorientierte Programmierung (OOP)
C# Über die Grundlagen Hinaus

bookPraxis: Methoden

Füllen Sie die fehlenden Lücken aus, um eine Methode zu erstellen, die die Fläche eines Kreises berechnet und den Wert zurückgibt.

index.cs

index.cs

copy
123456789101112131415161718192021222324252627282930313233
using System; public class ConsoleApp { class Point { public double x; public double y; } class Circle { public double radius; public Point center; ___ ___ ___() { // The formula is: pi . r . r // The value of pi is 3.14 // r is the radius ___ ___ * ___* radius; } } public static void Main(string[] args) { Point p = new Point(); p.x = 15; p.y = 15; Circle circle = new Circle(); circle.radius = 10; circle.center = p; Console.WriteLine($"Area of the circle with center at ({circle.center.x}, {circle.center.y}) and radius of {circle.radius} is {circle.area()}"); } }

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 8

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Awesome!

Completion rate improved to 2.04

bookPraxis: Methoden

Swipe um das Menü anzuzeigen

Füllen Sie die fehlenden Lücken aus, um eine Methode zu erstellen, die die Fläche eines Kreises berechnet und den Wert zurückgibt.

index.cs

index.cs

copy
123456789101112131415161718192021222324252627282930313233
using System; public class ConsoleApp { class Point { public double x; public double y; } class Circle { public double radius; public Point center; ___ ___ ___() { // The formula is: pi . r . r // The value of pi is 3.14 // r is the radius ___ ___ * ___* radius; } } public static void Main(string[] args) { Point p = new Point(); p.x = 15; p.y = 15; Circle circle = new Circle(); circle.radius = 10; circle.center = p; Console.WriteLine($"Area of the circle with center at ({circle.center.x}, {circle.center.y}) and radius of {circle.radius} is {circle.area()}"); } }

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 8
some-alt