Question: -Validate the XHTML using Document type XHTML 1.0 Transitional https://validator.w3.org/ and fix any errors ensuring that the code still functions the same as it did

-Validate the XHTML using Document type "XHTML 1.0 Transitional" https://validator.w3.org/ and fix any errors ensuring that the code still functions the same as it did before - --Note that the code validates that: ---A first and last name must be entered that doesn't include NUMBERS ---A valid email address has been entered ---A tuition type has been entered ---The student has entered credits and is only numbers ---A major has been selected

***********************

================== home.html

Tuition Fee Calculator

table {

margin: 0 auto;

}

img {

display: block;

margin-left: auto;

margin-right: auto;

}

Tuition fee Calculator

FristName

LastName

Email Address

Tuition Type

In-State

Out-of-State

International tuition

Financial Aid

Full-time/Part-time

Full-time

Part-time

Number of credits

Major



//Script to dsplay google map

function myMap() {

//create a variable to represent map div

var mapCanvas = document.getElementById("map");

//Define the properties of map

var mapOptions = {

center: new google.maps.LatLng(40.064416, -79.884218),

zoom: 17

};

//Set the map

var map = new google.maps.Map(mapCanvas, mapOptions);

}

================== variables.js

function validateForm() {

var form = document.forms["userform"]; //acccess form with the name

var fname = form["fname"].value; //acccess firstname value using by name=fname parameter

var lname = form["lname"].value; //acccess lastname value using by name=lname parameter

var email = form["emailid"].value; //acccess email value using by name=emailid parameter

var tuition_type = getTutitonType(); //acccess tuition_type value using by name=tuition_type parameter

var credits = form["credits"].value; //acccess credits value using by name=credits parameter

var major = getMajor(); //acccess major value using by name=major parameter

var emailpatt = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,4})$/; //regular expression for global email address

var validationReport = ""; // all error are append to this string intially we don't have no errors so it is empty

if (fname == null || fname == undefined || fname == "") {

validationReport += "FirstName is Required*" + " "; //if firstname is not entered

} else if (/\d/.test(fname)) {

//here i made changes to check for digit in the first name

validationReport += "[*]FirstName has number*" + " ";

}

if (lname == null || lname == undefined || lname.length

validationReport += "[*]LastName is Required*" + " "; //if lastname is not entered

} else if (/\d/.test(fname)) {

validationReport += "[*]LastName has number*" + " ";

}

if (email == null || email == undefined || email.length

validationReport += "[*]Email is Required*" + " "; //if email is not entered

} else if (!emailpatt.test(email)) {

validationReport += "[*]Invalid Email" + " "; //if invalid email is not entered

}

if (tuition_type == null || tuition_type == undefined || tuition_type.length

validationReport += "[*]Tuition Type is required*" + " "; //if Tuition Type is not entered

}

if (credits == null || credits == undefined || credits == "") {

validationReport += "[*]credits Field is Required*" + " "; //if credits are not entered

} else if (isNaN(credits)) {

validationReport += "[*]Credits should be numerical" + " "; //if Non numerical credits are not entered

}

if (major == null || major == undefined || major == "") {

validationReport += "[*]Major is required*" + " "; //if Major is not selected

} else if (getMajor() == "") {

validationReport += "[*]Invalid Major is selected" + " "; //if Major is not selected form the listed above

}

if (validationReport == "") {

//if no validation errors then call the result method to print the calculated tution fees

return result();

} else {

//If validation Errors are there we presenting them with a alert

alert("Validations is Failed: " + validationReport);

return false;

}

}

//here is the form reset function

//to display the confirmation dialog box and

//reset accordingly

function resetForm() {

if (confirm("Do you want to reset the form?") == true) {

var f = document.forms["userform"];

f.reset();

}

}

function getTutitonType() {

if (document.getElementById("instate1").checked) {

return "In-State";

} else if (document.getElementById("outofstate1").checked) {

return "Out-of-State";

} else if (document.getElementById("international1").checked) {

return "International Tuition "

}

return "";

}

// Full time or part time

function getFullTimeOrPartTime() {

var fulltime1 = document.getElementById("fulltime1").checked;

var parttime1 = document.getElementById("parttime1").checked;

if (fulltime1) {

return "Full Time";

} else if (parttime1) {

return "Part Time";

}

return "";

}

// Majors

function getMajor() {

major = String(document.getElementById("major").value);

if (major == "CIS") {

return "Computer & Information Systems";

} else if (major == "Business") {

return "Business";

} else if (major == "Economics") {

return "Economics";

} else if (major == "Finance") {

return "Finance";

} else if (major == "General") {

return "General Education";

} else if (major == "maj6") {

return "Data Science";

} else if (major == "maj7") {

return "Artificial Intelligence";

} else if (major == "maj8") {

return "Mechanical Engineering";

} else if (major == "maj9") {

return "Embedded System";

} else if (major == "maj10") {

return "Electrical Engineering";

}

return "";

}

//Displays Alert when an option is selected

function displayAlert() {

major = String(document.getElementById("major").value);

if (major == "CIS") {

alert('Computer & Information Systems majors are great for people who enjoy computers, coding, networking, and databases.');

} else if (major == "Business") {

alert('Business Management degrees can get you a wide range of jobs and require you to have a lot of knowledge in finance, economics, or accounting.');

} else if (major == "Economics") {

alert('An economics degree can et you positoins in a wide range of positions related to finance and technology.');

} else if (major == "Finance") {

alert('The finance degree involves helping businesses and consumers organize money.');

} else if (major == "General") {

alert('This choice will let you take a few classes to better gauge what you would like your degree to be in.');

} else if (major == "maj6") {

alert('A Data Science degree helps you to gain expertisse in big data.');

} else if (major == "maj7") {

alert('An Artificial Intelligence Degree helps to understand machine intelligence');

} else if (major == "maj8") {

alert('Mechanical Engineering helps you understand basic mechanism and principles behind various machines');

} else if (major == "maj9") {

alert('Embedded System degree will help one to design embedded smart systems.');

} else if (major == "maj10") {

alert('An Electrical Engineering degree will help you to deal with various electrical components and circuits.');

} else {

alert('Please Select a valid Major');

}

}

// This gets the information for displaying a summary of everything on the form as an alert

function buildStudentProfile(tutionFee) {

var lname = document.getElementById('lname').value;

var fname = document.getElementById('fname').value;

var emailid = document.getElementById('emailid').value;

var credits = document.getElementById("credits").value;

var str = "Student Name: " + fname + " " + lname + ' ';

str += "Email ID: " + emailid + ' ';

str += "Tuition Type: " + getTutitonType() + ' ';

str += "Fulltime or part time: " + getFullTimeOrPartTime() + ' ';

str += "Number of credits: " + credits + ' ';

str += "Major: " + getMajor() + ' ';

if (typeof(tutionFee) != "undefined" && tutionFee != null)

str += "Tuition cost w/ a $ " + tutionFee;

return str;

}

//This function hides the amount on pressing reset button

function hideResult() {

document.getElementById("result").style.visibility = "hidden";

}

function result() {

var fulltime1 = document.getElementById("fulltime1").checked;

var parttime1 = document.getElementById("parttime1").checked;

var confirmation = confirm("Are you sure want to print results?");

var credits = document.getElementById("credits").value;

var instft = [3746, 232, 33.20]

var instpt = [312, 20, 33.20]

var instate1 = document.getElementById("instate1").checked;

var oosft = [5619, 353, 49.80]

var oospt = [468, 30, 49.80]

var outofstate1 = document.getElementById("outofstate1").checked;

var ift = [7305, 353, 63.90];

var ipt = [609, 30, 63.90];

var international1 = document.getElementById("international1").checked;

var name = document.getElementById('lname').value;

// This line will print the results if the confirmation is true

if (confirmation === true) {

var results = 0.0;

var secondConfirmation;

// In state full time

if (instate1 == true && fulltime1 == true && credits >= 12 && credits

results = (instft[2] * credits) + (instft[0] + instft[1]);

}

// In state part time

else if (instate1 == true && parttime1 == true && credits

results = (credits * instpt[0]) + (credits * instpt[1]) + (credits * instpt[2]);

}

// Out of state full time

else if (outofstate1 == true && fulltime1 == true && credits >= 12 && credits

results = (oosft[2] * credits) + (oosft[0] + oosft[1]);

}

// Out of state part time

else if (outofstate1 == true && parttime1 == true && credits

results = (credits * oospt[0]) + (credits * oospt[1]) + (credits * oospt[2]);

}

// International full time

else if (international1 == true && fulltime1 == true && credits >= 12 && credits

results = (ift[2] * credits) + (ift[0] + ift[1]);

}

// International part time

else if (international1 == true && parttime1 == true && credits >= 1 && credits

results = (credits * ipt[0]) + (credits * ipt[1]) + (credits * ipt[2]);

}

secondConfirmation = confirm(buildStudentProfile(results));

var lname = document.getElementById("lname").value;

var fname = document.getElementById("fname").value;

document.getElementById("result").innerHTML = (fname + " " + lname) + " would owe $" + results + "";

if (secondConfirmation == true) {

var a = confirm("Are you sure to Submit?");

if (a == true) {

//user confrim to submit

return true;

} else {

alert("no information has been submitted");

//user press cancel to submit

return false;

}

} else {

alert("no information has been submitted");

alert('Correct any errors on the form.');

return false;

}

} else {

alert("no information has been submitted");

return false;

}

}

================== formprocess.html

Form Processor

document.write("

Your form has been submitted!

You entered the following data:

");

var formData = location.search;

formData = formData.substring(1, formData.length);

while (formData.indexOf("+") != -1) {

formData = formData.replace("+", " ");

}

formData = unescape(formData);

var formArray = formData.split("&");

for (var i = 0; i

document.writeln(formArray[i] + "
");

}

alert("Someone From our University will contact you via Email.");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!