From 122a47f7d409def5cee65efdff12f7c3010a7e40 Mon Sep 17 00:00:00 2001 From: Seoyeon Lee Date: Sun, 8 Dec 2024 00:03:24 -0500 Subject: [PATCH] This activity was easy. No programming language required work, maybe that's why I feel it's easy to complete. --- planning.md | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/planning.md b/planning.md index 40d428a..8b5375b 100644 --- a/planning.md +++ b/planning.md @@ -37,19 +37,39 @@ return digit_names[number] ## Integers under 20 If the integer is under 10, then use the procedure described above. Otherwise, ... (this is where you take over!) - +digit_names2 = [ + "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", + "eighteen", "nineteen" +] +to get the digit, we devide the number by 10, and consider the remainder. +return dignt_names2 [number%10] ## Integers under 100 - - +If the integer is under 20, use the previous procedure. Otherwise, for the numbers from 20 to 99, +we do this. +digit_names3 = [ + "twenty", "thirty" , ....... "eighty", "ninety" +] +We take first digit, get the name from the digit_names3. +Digit 1 = digit_names3 [number//10-2] +add hypen and add digit names [number%10]if the second digit is not zero. Else, add nothing. ## Integers under 1000 - +Digit 1 = digit_names [number//100] +add "hundred" +R1 = number%100 +If R1 is not zero, we add "and", then we call Integers under 100 procedure on R1. ## Integers under 1000000 +Q1 = number//1000 +We call Intergers under 1000 procedure on Q1 +We add "thousand" +R1 = number%1000 +If R1 is not zero, we call Integers under 1000 procedure on R1 ## Negative integers down to -1 million We won't deal with negative integers in this problem set, but how would you deal with a negative integer, using the functions above? - - +Number multiped by negative 1, we treat it as a new number. +We call the same function as before (now it's positive number) +We write "negative" in the begining of the answer.