Please write JavaScript code for the two exercises listed below. Be sure to document your work with comments for code management.
Exercise 1 - Date object
1. Use the Date object to print today’s date in this format:
Today is Friday, October 19, 2018.
2. Create a prototype for the Date object that will display the days of the week and months of the year.
3. Calculate and display the number of days until your next
birthday.
Exercise 2 - Math object
1. Calculate the area of a circle using the Math object. Use the toFixed() method to set the decimal places to two digits
Exercise 1:
I include 1,2 in one html file and 3 in another file,
1.html:
<!DOCTYPE html>
<html>
<head>
<title>webpage</title>
</head>
<body>
<p id="date"></p><hr/>
<h3 id="weekdays"></h3><br/>
<div
id="daysOfWeek"></div><hr/>
<h3 id="months"></h3><br/>
<div
id="monthsInYear"></div><br/>
<script>
var date = new Date();
var weekday="";
var month="";
var weekdays = new Array('Sunday',
'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',
'Saturday');
var months = new Array('January', 'February', 'March',
'April', 'May', 'June', 'July', 'August', 'September', 'October',
'November',
'December');
var st = "The days of a week are:";
var st2 = "The months in a year are:";
var dayOfWeek = weekdays[date.getUTCDay()];
var dayOfMonth = date.getUTCDate();
var currentMonth = months[date.getUTCMonth()];
var currentYear = date.getUTCFullYear();
var today ="Today is " +dayOfWeek + ", " +
currentMonth + " "+dayOfMonth + ", " + currentYear;
document.getElementById("date").innerHTML = today
;
document.getElementById("weekdays").innerHTML = st
;
for( var i=0; i<weekdays.length;i++)
{
weekday += "<li>" +
weekdays[i] + "</li>";
document.getElementById("daysOfWeek").innerHTML = weekday ;
}
document.getElementById("months").innerHTML = st2
;
for( var j=0; j<months.length;j++)
{
month += "<li>" + months[j] +
"</li>";
document.getElementById("monthsInYear").innerHTML = month ;
}
</script>
</body>
</html>
Output:

2.html:
<!DOCTYPE html>
<html>
<head>
<title>webpage</title>
</head>
<body>
<p>Enter Birthday in ddmmyyy
format</p>
<p>Date: <input id="birthdate"
type="text"> Month:
<input id="birthmonth"
type="text"></p>
<input type="button" value="submit"
onclick="calculateDays()">
<p id="result"></p>
<br>
<br>
<script>
function calculateDays()
{
var getDaysInMonth = function(month,year) {
return new Date(year, month, 0).getDate();
};
var birthdate = document.getElementById("birthdate").value;
var birthmonth =
document.getElementById("birthmonth").value;
var inv = "invalid";
var myBirthday, today, birthday, diff, days;
today = new Date();
console.log("hi");
if(birthmonth.length!=0&&birthdate.length!=0)
{
if (birthmonth<12||birthmonth>0)
{
if(birthdate >
getDaysInMonth(today.getFullYear(),
birthmonth)||birthdate<1)
{
document.getElementById("result").innerHTML = inv;
}
else
{
birthday = new
Date(today.getFullYear(),birthmonth-1,birthdate);
if( today.getTime()
> birthday.getTime()) {
birthday.setFullYear(birthday.getFullYear()+1);
}
diff = birthday.getTime()-today.getTime();
days =
Math.floor(diff/(1000*60*60*24));
document.getElementById("result").innerHTML = "No.of days left till
next birtday: "+days ;
}
}
else
{
document.getElementById("result").innerHTML = inv ;
}
}
else
document.getElementById("result").innerHTML = inv ;
}
</script>
</body>
</html>

Exercise 2:
<!DOCTYPE html>
<html>
<head>
<title>webpage</title>
</head>
<body>
<p>Enter Radius to find Area of
Circle</p>
<p>Radius: <input id="radius"
type="text">
<input type="button" value="submit"
onclick="calculateArea()">
<p id="result"></p>
<br>
<br>
<script>
function calculateArea()
{
var r = document.getElementById("radius").value;
var A;
if(r>0&&r.length!=0)
{
A = r*r*Math.PI;
document.getElementById("result").innerHTML = A.toFixed(2) ;
}
else
{
document.getElementById("result").innerHTML = "Enter valid Radius
value";
}
}
</script>
</body>
</html>
Output:

Please write JavaScript code for the two exercises listed below. Be sure to document your work...
Write in python code
Project 11-1: Birthday Calculator Create a program that accepts a name and a birth date and displays the person's birthday the current day, the person's age, and the number of days until the person's next birthday Console Birthday Calculator Enter name: Joel Enter birthday (MM/DD/YY): 2/4/68 Birthday: Sunday, February 04, 1968 Today: Joel is 48 years old. Joel's birthday is in 73 days Tuesday, November 22, 2016 Continue? (y/n): y Enter name: Django Enter birthday (MM/DD/YY):...
General Requirements: • You should create your programs with good programming style and form using proper blank spaces, indentation and braces to make your code easy to read and understand; • You should create identifiers with sensible names; • You should make comments to describe your code segments where they are necessary for readers to understand what your code intends to achieve. • Logical structures and statements are properly used for specific purposes. Objectives This assignment requires you to write...
Description: This project focuses on creating a Java class, Date.java, along with a client class, DateCleint.java, which will contain code that utilizes your Date.java class. You will submit both files (each with appropriate commenting). A very similar project is described in the Programming Projects section at the end of chapter 8, which you may find helpful as reference. Use (your own) Java class file Date.java, and a companion DateClient.java file to perform the following: Ask user to enter Today’s...
write a C programming code for the following prompt. please
use stucture concept and test if the code works perfectly.
Project Description: In this project, you will write a program to calculate the roots of a quadratic equation. Structure concepts will be used in this project. Your program will prompt the user to enter the coefficients of a quadra coefficientsType. Then it will compute the roots of the quadratic equation and store the result in a structure variable of type...
Description: This project focuses on creating a Java class, Date.java, along with a client class, DateCleint.java, which will contain code that utilizes your Date.java class. You will submit both files (each with appropriate commenting). A very similar project is described in the Programming Projects section at the end of chapter 8, which you may find helpful as reference. Use (your own) Java class file Date.java, and a companion DateClient.java file to perform the following: Ask user to enter Today’s...
For the program described below, document your code well. Use descriptive identifier names. Use spaces and indentation to improve readability. Include a beginning comment block as well as explanatory comments throughout. In the beginning comment block, add your name, program name, date written, program description. The description briefly describes what the program does. Include a comment at the beginning of each method to describe what the method does. Write a program to perform operations on square matrices (i.e. equal number...
For the program described below, document your code well. Use descriptive identifier names. Use spaces and indentation to improve readability. Include a beginning comment block as well as explanatory comments throughout. In the beginning comment block, add your name, program name, date written, program description. The description briefly describes what the program does. Include a comment at the beginning of each method to describe what the method does. Write a program to perform operations on square matrices (i.e. equal number...
Code is in C#
Your instructor would like to thank to Marty Stepp and Hélène Martin at the University of Washington, Seattle, who originally wrote this assignment (for their CSE 142, in Java) This program focuses on classes and objects. Turn in two files named Birthday.cs and Date.cs. You will also need the support file Date.dll; it is contained in the starter project for this assignment. The assignment has two parts: a client program that uses Date objects, and a...
Please write a code in Java where it says your // your code here to run the code smoothly. Import statements are not allowed for this assignment, so don't use them. _ A Java method is a collection of statements that are grouped together to perform an operation. Some languages also call this operation a Function. When you call the System.out.println() method, for example, the system actually executes several statements in order to display a message on the console. Please...
Can you please write the two C++ modules below is a step by step instuctions to follow that will make it very easy thanks. Create a module called pqueue.cpp that implements priority queues, with a header file calledpqueue.hthat describes what pqueue.cpp exports. The interface includes the following, and nothing else. Types ItemType and PriorityType are discussed below under the refinement plan. A type, PriorityQueue. Creating a PriorityQueue object with line PriorityQueue q; makes q be an initially empty priority queue....