Question 1: Writing a simple script
Create a simple node.js script called q1_1.js that takes in two names on the on the command line and then prints a capitalized version of the names to the console and number of characters of in the name. As part of the assignment write a function called printOutput that prints the capitalized version of the name and the number of characters for a single name. Use your function in the main program.
Example output:
Question 2: Conditionals
Create a node.js script called q1_2.js that takes in two numbers and prints out whether the first number is divisible by the second number, the second number is divisible by the first number, the sum of the two numbers, which of the two number is bigger, and whether number are integers. As part of this assignment, write two functions and use them in your program. The first function determines if a number is divisible by a second number and return true if it is. Call this function divisible. The second function checks if a number is an integer and returns true if it is. Call this function isInteger. Use these functions in your main program.
Example output:
Question 3: Loops
Create a node.js script called q1_3.js that takes in 2 parameters. The first presents the character to repeat, the second is the number of lines. Using the character draw a square pattern, two triangle patterns as shown in the output. Write a function called createLine, that takes in a character and a number and returns a line with that many repetitions of the character.
Sample output:
Question 4: Problem solving
Write a node.js Script called q1_4.js that takes in takes in two parameters. The first is a radius of a circle, the second is the length of the side of a square.
1.Determines if the square fits in the circle, or the circle fits in the square, or they do not fit in each other or the circle touches the square on a single point at each side of the square, or the square touches the circle at each of it's corners. Display the appropriate output.
2.Calculate the area of the circle that does not overlap the square.
Create meaning output to inform the user of the results