Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions homework.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//1- The Fortune Teller:

var numOfChld = 4;
var pName = "most lovely woman";
var loc = "Riyadh";
var jobTit = "Web developer";

console.log("You will be a " + jobTit + " in " + loc + ", and married to " + pName + " with " + numOfChld + " kids.");

//----------------------------------------

//2- The Age Calculator:

var currentY = new Date().getFullYear();
var birthY = 1993;
var age = currentY - birthY;

console.log("They are either " + (age - 1) + " or " + age);

//----------------------------------------

//3- The Lifetime Supply Calculator:

var birthY = 1993;
var currentY = new Date().getFullYear();
var age = currentY - birthY;
var maxAge = 88;
var estimatedAmount = 3;
var totalSupply = (estimatedAmount * 365) * (maxAge - age);

console.log(`You will need ${totalSupply} to last you until the ripe old age of ${maxAge}`);

//-------------------------------------

4- The Geometrizer

var radius = 5;
var circumference = (2 * Math.PI) * radius;
var area = Math.pow(radius,2) * Math.PI;

console.log(`The circumference is ${circumference}`);
console.log(`The area is ${area}`);

-------------------------------------------------

5-

var converterCtof = (tem) => {
return (tem * 9/5) + 32;
}

var converterFtoC = (tem) => {
return (tem - 32) * (5/9) ;
}

var celsius = 19;
var temInFahren = converterCtof(celsius);
console.log(`${celsius}°C is ${temInFahren}°F`);

var fahrenheit = 77;
console.log(`${fahrenheit}°F is ${converterFtoC(fahrenheit)}°C`);