JAVASCRIPT Write a program called calendarjs that displays a

JAVASCRIPT

Write a program called calendar.js that displays a calendar month for May 2012 as the month and year. You must use a loop. The format of the month should be as shown below: Hint: You can\'t use console log and print on the same line. Try storing the entire row as one concatenated string and then displaying it. You must use loops for this one. Do not just print the calendar as a series of console.log statements! https://puu.sh/rPZyq/92af94503b.png

Write a program called crypto.js that encrypts passwords containing uppercase/lowercase characters, digits, and special characters. Use Pizza2Day! For the password.

See Sample Execution Below:

This program will encrypt user passwords.

Password: Pizza2Day!

Encrypting ……………

Encrypted Password: Njaam2Fmc!

The encryption key to use is below:

Original Value

Encrypted Value

a

m

b

h

c

t

d

f

e

g

f

k

g

b

h

p

i

j

j

w

k

e

l

r

m

q

n

s

o

l

p

n

q

i

r

u

s

o

t

x

u

z

v

y

w

v

x

d

y

c

z

a

Hint: Think how you could represent the encrypted value with an array and the decrypted value as the index position of the array. A dictionary would be a better approach.

Zip all your files in a folder named assignment 2. Zip that up and rename it to lastName_Assig#_Attempt#.zip ex: corbin_assig2_Attempt1.zip and submit in the dropbox.

Original Value

Encrypted Value

a

m

b

h

c

t

d

f

e

g

f

k

g

b

h

p

i

j

j

w

k

e

l

r

m

q

n

s

o

l

p

n

q

i

r

u

s

o

t

x

u

z

v

y

w

v

x

d

y

c

z

a

Solution

Program for calender.js:

calDaysOfWeek = [];

calDaysOfWeek.push(\"Sun\", \"Mon\", \"Tues\", \"Wed\", \"Thur\", \"Fri\", \"Sat\");

var s = \"MAY 2012\ \";

var numDaysOfWeek = calDaysOfWeek.length;

var firstDay = 2;

var numDaysOfMonth = 31;

var numWeeks = 5;

for (var i=0; i<numWeeks; i++) {

for (var j=0; j<numDaysOfWeek; j++) {

var n = i * numDaysOfWeek + j + 1 - firstDay ;

if (n < 1 || n > numDaysOfMonth) {

s += \'   \';

}

else {

if (n < 10)

{

s += \' \';

}

s += n + \' \' ;

}

}

s += \"\ \";

}

alert(s);

Program for crypto.js:

$(\".buttonClick\").click(function () {

$(\"input[type=text]\").each(function () {

var validated = true;

if(this.value.length < 8)

validated = false;

if(!/\\d/.test(this.value))

validated = false;

if(!/[a-z]/.test(this.value))

validated = false;

if(!/[A-Z]/.test(this.value))

validated = false;

if(/[^0-9a-zA-Z]/.test(this.value))

validated = false;

$(\'div\').text(validated ? \"pass\" : \"fail\");

});

});

JAVASCRIPT Write a program called calendar.js that displays a calendar month for May 2012 as the month and year. You must use a loop. The format of the month sh
JAVASCRIPT Write a program called calendar.js that displays a calendar month for May 2012 as the month and year. You must use a loop. The format of the month sh
JAVASCRIPT Write a program called calendar.js that displays a calendar month for May 2012 as the month and year. You must use a loop. The format of the month sh
JAVASCRIPT Write a program called calendar.js that displays a calendar month for May 2012 as the month and year. You must use a loop. The format of the month sh

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site