From 3a878bb1c57166731e082f1862d97e5d103975a7 Mon Sep 17 00:00:00 2001 From: ANFAL Date: Tue, 15 Jan 2019 06:56:32 +0300 Subject: [PATCH] Yay!!! my first homework! --- HW.txt | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 HW.txt diff --git a/HW.txt b/HW.txt new file mode 100644 index 0000000..57335ce --- /dev/null +++ b/HW.txt @@ -0,0 +1,53 @@ +//1-The Fortune Teller + +var numberOfKids = 9; +var fatherName = "Abdulrahman"; +var homeTown = "Alahsaa"; +var jobTitle = "retired mother"; +​ +var motherName = "You will be a " + jobTitle + " in " + homeTown + ", and married to " + fatherName + " with " + numberOfKids + " kids."; +console.log(motherName); +​ + +//2-The Age Calculator + +var currentYear = 2019; +var birthYear = 1995; + + var possibleAge = currentYear - birthYear; + console.log("You are either " + possibleAge + " or " + possibleAge + ", substituting the values.") + + +//3-The Lifetime Supply Calculator + +var currentAge = 24; +var maxAge = 85; +var estPerDay = 5; + + +var yearsToLive = maxAge - currentAge ; + console.log("Years that I will enjoy my favorite snack: " + yearsToLive ) + +var snackLover = yearsToLive * estPerDay; + console.log("I would eat a lot of snack for the rest of my life! the amount is: " + snackLover ) + +//Bonus +var currentYear = birthYear + currentAge; + console.log("This year is " + currentYear ) + + +//4-The Geometrizer +var radius = 5; +var circumference = 2*radius; +console.log("The circumference is " + circumference); +var area = radius*radius; +console.log("The area is " + area); + +//5-The Temperature Converter + +var celsius = 14; +var cToF = (celsius*9)/5 + 32; +console.log(celsius + " Celsius is " + cToF + " fahrenheit"); +var fahrenheit = 57; +var fToC = ((fahrenheit - 32)*5)/9; +console.log(fahrenheit + " Fahrenheit is " + fToC + " celsius"); \ No newline at end of file