From fc58a89ec89837431caf472b90b944f24ed42765 Mon Sep 17 00:00:00 2001 From: vista-man <524715@vistacollege.nl> Date: Tue, 28 Jan 2025 09:39:02 +0100 Subject: [PATCH] Translate user prompts and comments to Dutch; delete unused weather log file --- Csharp/Bankrekening/Program.cs | 47 ++++++++++++++++------------------ Csharp/Calc/Program.cs | 26 +++++++++---------- Csharp/Gokspel/Program.cs | 44 ++++++++++++++++--------------- Csharp/Woordenboek/Program.cs | 17 +++++++----- Python/api/weather.log | 4 --- 5 files changed, 69 insertions(+), 69 deletions(-) delete mode 100644 Python/api/weather.log diff --git a/Csharp/Bankrekening/Program.cs b/Csharp/Bankrekening/Program.cs index 05b2b8d..a1905c6 100644 --- a/Csharp/Bankrekening/Program.cs +++ b/Csharp/Bankrekening/Program.cs @@ -3,24 +3,23 @@ using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; -// Class representing a bank account class Bankrekening { public string Rekeningnummer { get; } private decimal saldo; private List transacties; - // Constructor to initialize account number and starting balance public Bankrekening(string rekeningnummer, decimal beginsaldo) { + // Initialiseer rekeningnummer en beginsaldo Rekeningnummer = rekeningnummer; saldo = beginsaldo; transacties = new List(); } - // Method to deposit money into the account with a description public void Storten(decimal bedrag, string beschrijving) { + // Stort geld op de rekening met een beschrijving if (bedrag > 0) { saldo += bedrag; @@ -28,13 +27,13 @@ class Bankrekening } else { - throw new ArgumentException("The amount must be positive."); + throw new ArgumentException("Het bedrag moet positief zijn."); } } - // Method to withdraw money from the account with a description public void Opnemen(decimal bedrag, string beschrijving) { + // Neem geld op van de rekening met een beschrijving if (bedrag > 0 && bedrag <= saldo) { saldo -= bedrag; @@ -42,40 +41,38 @@ class Bankrekening } else { - throw new ArgumentException("Insufficient balance or invalid amount."); + throw new ArgumentException("Onvoldoende saldo of ongeldig bedrag."); } } - // Method to check the current balance public decimal ControleerSaldo() { + // Controleer het huidige saldo return saldo; } - // Method to get the transaction history public List GetTransactieGeschiedenis() { + // Haal de transactiegeschiedenis op return transacties; } } -// Class representing a transaction class Transactie { public decimal Bedrag { get; } public string Beschrijving { get; } public DateTime Datum { get; } - // Constructor to initialize transaction details public Transactie(decimal bedrag, string beschrijving) { + // Initialiseer transactiegegevens Bedrag = bedrag; Beschrijving = beschrijving; Datum = DateTime.Now; } } -// Main form for the application public class MainForm : Form { private Bankrekening mijnRekening; @@ -86,9 +83,9 @@ public class MainForm : Form private Button opnemenButton; private Button transactieGeschiedenisButton; - // Constructor to initialize the form and its controls public MainForm() { + // Initialiseer de GUI-componenten mijnRekening = new Bankrekening("NL01BANK0123456789", 1000); saldoLabel = new Label() @@ -111,7 +108,7 @@ public class MainForm : Form BackColor = Color.White, ForeColor = Color.Black, BorderStyle = BorderStyle.FixedSingle, - PlaceholderText = "Amount" + PlaceholderText = "Bedrag" }; beschrijvingTextBox = new TextBox() { @@ -122,11 +119,11 @@ public class MainForm : Form BackColor = Color.White, ForeColor = Color.Black, BorderStyle = BorderStyle.FixedSingle, - PlaceholderText = "Description" + PlaceholderText = "Beschrijving" }; stortenButton = new Button() { - Text = "Deposit", + Text = "Storten", Top = 140, Left = 20, Width = 260, @@ -138,7 +135,7 @@ public class MainForm : Form }; opnemenButton = new Button() { - Text = "Withdraw", + Text = "Opnemen", Top = 200, Left = 20, Width = 260, @@ -150,7 +147,7 @@ public class MainForm : Form }; transactieGeschiedenisButton = new Button() { - Text = "Transaction History", + Text = "Transactiegeschiedenis", Top = 260, Left = 20, Width = 260, @@ -172,15 +169,15 @@ public class MainForm : Form Controls.Add(opnemenButton); Controls.Add(transactieGeschiedenisButton); - Text = "Bank Account Management"; + Text = "Bankrekening Beheer"; Size = new Size(320, 380); StartPosition = FormStartPosition.CenterScreen; BackColor = Color.White; } - // Event handler for deposit button click private void StortenButton_Click(object sender, EventArgs e) { + // Verwerk de storting try { decimal bedrag = decimal.Parse(bedragTextBox.Text); @@ -194,9 +191,9 @@ public class MainForm : Form } } - // Event handler for withdraw button click private void OpnemenButton_Click(object sender, EventArgs e) { + // Verwerk de opname try { decimal bedrag = decimal.Parse(bedragTextBox.Text); @@ -210,12 +207,12 @@ public class MainForm : Form } } - // Event handler for transaction history button click private void TransactieGeschiedenisButton_Click(object sender, EventArgs e) { + // Toon de transactiegeschiedenis var transactieGeschiedenis = mijnRekening.GetTransactieGeschiedenis(); - string geschiedenis = "Transaction History:\n"; - geschiedenis += "Date\t\tDescription\t\tAmount\n"; + string geschiedenis = "Transactiegeschiedenis:\n"; + geschiedenis += "Datum\t\tBeschrijving\t\tBedrag\n"; geschiedenis += "---------------------------------------------\n"; foreach (var transactie in transactieGeschiedenis) { @@ -225,16 +222,16 @@ public class MainForm : Form } } -// Main program class class Program { static void Main() { + // Start de applicatie var mijnRekening = new Bankrekening("NL01BANK0123456789", 1000); mijnRekening.Storten(100.00m, "Initial deposit"); mijnRekening.Opnemen(50.00m, "ATM withdrawal"); - Console.WriteLine("Transaction History:"); + Console.WriteLine("Transactiegeschiedenis:"); foreach (var transactie in mijnRekening.GetTransactieGeschiedenis()) { Console.WriteLine($"{transactie.Datum}: {transactie.Beschrijving} - {transactie.Bedrag:C}"); diff --git a/Csharp/Calc/Program.cs b/Csharp/Calc/Program.cs index e5a06af..da61dde 100644 --- a/Csharp/Calc/Program.cs +++ b/Csharp/Calc/Program.cs @@ -4,21 +4,21 @@ class Program { static void Main(string[] args) { - // Ask the user to enter the first number - Console.WriteLine("Enter the first number:"); + // Vraag de gebruiker om het eerste getal in te voeren + Console.WriteLine("Voer het eerste getal in:"); double num1 = Convert.ToDouble(Console.ReadLine()); - // Ask the user to enter an operator (+, -, *, /) - Console.WriteLine("Enter an operator (+, -, *, /):"); + // Vraag de gebruiker om een operator in te voeren (+, -, *, /) + Console.WriteLine("Voer een operator in (+, -, *, /):"); string op = Console.ReadLine(); - // Ask the user to enter the second number - Console.WriteLine("Enter the second number:"); + // Vraag de gebruiker om het tweede getal in te voeren + Console.WriteLine("Voer het tweede getal in:"); double num2 = Convert.ToDouble(Console.ReadLine()); double result = 0; - // Perform the operation based on the entered operator + // Voer de bewerking uit op basis van de ingevoerde operator switch (op) { case "+": @@ -37,18 +37,18 @@ class Program } else { - // Display an error message if attempting to divide by zero - Console.WriteLine("Cannot divide by zero."); + // Toon een foutmelding bij poging tot delen door nul + Console.WriteLine("Kan niet delen door nul."); return; } break; default: - // Display an error message if the entered operator is invalid - Console.WriteLine("Invalid operator."); + // Toon een foutmelding bij een ongeldige operator + Console.WriteLine("Ongeldige operator."); return; } - // Display the result of the calculation - Console.WriteLine("The result is: " + result); + // Toon het resultaat van de berekening + Console.WriteLine("Het resultaat is: " + result); } } diff --git a/Csharp/Gokspel/Program.cs b/Csharp/Gokspel/Program.cs index d2d6c4c..718c7c3 100644 --- a/Csharp/Gokspel/Program.cs +++ b/Csharp/Gokspel/Program.cs @@ -16,39 +16,39 @@ class Program : Form public Program() { - // Initialize the random number to guess + // Initialiseer het te raden getal numberToGuess = random.Next(1, 101); - // Set up the form + // Stel het formulier in this.Text = "Gokspel"; this.Size = new System.Drawing.Size(300, 200); - // Create and add the prompt label + // Maak en voeg het promptlabel toe Label promptLabel = new Label(); promptLabel.Text = "Raad het getal tussen 1 en 100:"; promptLabel.Location = new System.Drawing.Point(10, 20); promptLabel.AutoSize = true; this.Controls.Add(promptLabel); - // Create and add the input box + // Maak en voeg het invoervak toe inputBox = new TextBox(); inputBox.Location = new System.Drawing.Point(10, 50); this.Controls.Add(inputBox); - // Create and add the guess button + // Maak en voeg de gokknop toe guessButton = new Button(); guessButton.Text = "Gok"; guessButton.Location = new System.Drawing.Point(10, 80); guessButton.Click += new EventHandler(GuessButton_Click); this.Controls.Add(guessButton); - // Create and add the result label + // Maak en voeg het resultaatlabel toe resultLabel = new Label(); resultLabel.Location = new System.Drawing.Point(10, 110); resultLabel.AutoSize = true; this.Controls.Add(resultLabel); - // Create and add the restart button (initially hidden) + // Maak en voeg de herstartknop toe (aanvankelijk verborgen) restartButton = new Button(); restartButton.Text = "Opnieuw"; restartButton.Location = new System.Drawing.Point(10, 140); @@ -56,7 +56,7 @@ class Program : Form restartButton.Visible = false; this.Controls.Add(restartButton); - // Set up the confetti timer + // Stel de confetti-timer in confettiTimer = new System.Windows.Forms.Timer(); confettiTimer.Interval = 30; confettiTimer.Tick += new EventHandler(ConfettiTimer_Tick); @@ -64,45 +64,46 @@ class Program : Form private void GuessButton_Click(object sender, EventArgs e) { + // Verwerk de gok van de gebruiker int userGuess; if (int.TryParse(inputBox.Text, out userGuess)) { if (userGuess < numberToGuess) { - resultLabel.Text = "Too low! Try again."; + resultLabel.Text = "Te laag! Probeer opnieuw."; } else if (userGuess > numberToGuess) { - resultLabel.Text = "Too high! Try again."; + resultLabel.Text = "Te hoog! Probeer opnieuw."; } else { - resultLabel.Text = "Congratulations! You guessed the correct number."; + resultLabel.Text = "Gefeliciteerd! Je hebt het juiste getal geraden."; StartConfetti(); - restartButton.Visible = true; // Show the restart button + restartButton.Visible = true; // Toon de herstartknop } } else { - resultLabel.Text = "Invalid input. Please enter a number."; + resultLabel.Text = "Ongeldige invoer. Voer een getal in."; } } private void RestartButton_Click(object sender, EventArgs e) { - // Reset the game + // Reset het spel numberToGuess = random.Next(1, 101); resultLabel.Text = ""; inputBox.Text = ""; confettiList.Clear(); confettiTimer.Stop(); - restartButton.Visible = false; // Hide the restart button + restartButton.Visible = false; // Verberg de herstartknop this.Invalidate(); } private void StartConfetti() { - // Initialize confetti + // Initialiseer confetti confettiList.Clear(); for (int i = 0; i < 100; i++) { @@ -113,7 +114,7 @@ class Program : Form private void ConfettiTimer_Tick(object sender, EventArgs e) { - // Update confetti positions + // Update de posities van de confetti for (int i = 0; i < confettiList.Count; i++) { confettiList[i].Update(); @@ -124,7 +125,7 @@ class Program : Form protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); - // Draw confetti + // Teken de confetti foreach (var confetti in confettiList) { e.Graphics.FillEllipse(new SolidBrush(confetti.Color), confetti.Position.X, confetti.Position.Y, confetti.Size, confetti.Size); @@ -134,6 +135,7 @@ class Program : Form [STAThread] static void Main() { + // Start de applicatie Application.EnableVisualStyles(); Application.Run(new Program()); } @@ -149,7 +151,7 @@ class Confetti public Confetti(Random random, Size clientSize) { - // Initialize confetti properties + // Initialiseer de eigenschappen van de confetti Position = new PointF(random.Next(clientSize.Width), random.Next(clientSize.Height)); SpeedY = (float)(random.NextDouble() * 2 + 1); SpeedX = (float)(random.NextDouble() * 2 - 1); @@ -159,8 +161,8 @@ class Confetti public void Update() { - // Update confetti position and apply gravity + // Update de positie van de confetti en pas zwaartekracht toe Position = new PointF(Position.X + SpeedX, Position.Y + SpeedY); - SpeedY += 0.1f; // gravity effect + SpeedY += 0.1f; // zwaartekracht effect } } diff --git a/Csharp/Woordenboek/Program.cs b/Csharp/Woordenboek/Program.cs index 9199dad..66c4a4e 100644 --- a/Csharp/Woordenboek/Program.cs +++ b/Csharp/Woordenboek/Program.cs @@ -15,8 +15,9 @@ namespace DictionaryApp public Program() { + // Initialiseer de GUI-componenten wordTextBox = new TextBox { Left = 50, Top = 20, Width = 200 }; - searchButton = new Button { Text = "Search", Left = 260, Top = 20, Width = 100 }; + searchButton = new Button { Text = "Zoek", Left = 260, Top = 20, Width = 100 }; meaningTextBox = new TextBox { Left = 50, Top = 60, Width = 310, Height = 200, Multiline = true, ScrollBars = ScrollBars.Vertical, ReadOnly = true }; searchButton.Click += new EventHandler(SearchButton_Click); @@ -27,42 +28,45 @@ namespace DictionaryApp Controls.Add(searchButton); Controls.Add(meaningTextBox); - Text = "Dictionary"; + Text = "Woordenboek"; Size = new System.Drawing.Size(400, 300); } private void Form_Resize(object? sender, EventArgs e) { + // Pas de grootte van het tekstvak aan bij het wijzigen van de grootte van het formulier meaningTextBox.Width = this.ClientSize.Width - 100; meaningTextBox.Height = this.ClientSize.Height - 100; } private void WordTextBox_KeyDown(object? sender, KeyEventArgs e) { + // Zoek bij het indrukken van de Enter-toets if (e.KeyCode == Keys.Enter) { SearchButton_Click(this, new EventArgs()); - e.SuppressKeyPress = true; // Prevent the beep sound on Enter key press + e.SuppressKeyPress = true; // Voorkom het piepgeluid bij het indrukken van de Enter-toets } } private async void SearchButton_Click(object? sender, EventArgs e) { + // Haal de betekenis van het woord op van de API string word = wordTextBox.Text; string? meaning = await GetMeaningFromApi(word); - meaningTextBox.Text = meaning ?? "Meaning not found."; + meaningTextBox.Text = meaning ?? "Betekenis niet gevonden."; } private async Task GetMeaningFromApi(string word) { try { + // Maak een verzoek naar de woordenboek-API string apiUrl = $"https://api.dictionaryapi.dev/api/v2/entries/en/{word}"; HttpResponseMessage response = await client.GetAsync(apiUrl); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); - // Parse the responseBody to extract the meaning - // This is a simplified example, you may need to adjust the parsing based on the actual API response format + // Parse de JSON-respons om de betekenis te extraheren var json = System.Text.Json.JsonDocument.Parse(responseBody); var meaning = json.RootElement[0].GetProperty("meanings")[0].GetProperty("definitions")[0].GetProperty("definition").GetString(); return meaning; @@ -76,6 +80,7 @@ namespace DictionaryApp [STAThread] public static void Main() { + // Start de applicatie Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Program()); diff --git a/Python/api/weather.log b/Python/api/weather.log deleted file mode 100644 index 7057ffc..0000000 --- a/Python/api/weather.log +++ /dev/null @@ -1,4 +0,0 @@ - -Weer op coördinaten (50.8876735, 5.9773285) in Heerlen: -Temperatuur: 7.48°C -Weer: clear sky