Category: Websites, web programming

Php

Instructions
QUESTION 1.

Write a program that displays, validates, and processes a form for entering information about a package to be shipped from Tema Port. The form should contain inputs fields for the FROM and TO addresses for the package, the SOURCE and the DESTINATION contact number, dimensions of the package, and weight of the package. The validation should check (at least) that the package weighs no more than 150 pounds and that no dimension of the package is more than 36 inches. The processing function in your program should print out the information about the package in an organized, formatted report.

Note the following:

– All submissions should be in the form or a zipped attachment and devoid of plagiarized content

– The form to accept the input should be on a different file named “InputForm.html”

– The Php file that would accept and process the form should be named “ValidateForm.php”

– Finally, the file that would display the processed information should be named “OutPutForm.php”

php and sqlite

database has 4 tables (teachers, students, courses and performance). php needs to have user input to search 4 different things from that database.

1. count all course credits on given year
2. display all studies for given user
3. count average grade of given  course
4. print teachers that have given most grades

simple math game javascript

I need help by programming a small math game with javascript. I already have the structure on my file that I want, but the program is not working yet.

IDEA OF PROJECT
1. question for an addition between 1 and 100 (random numbers)
2. if correct go to subtraction between 1 and 100, if not repeat and stay on this level
3. continuing the structure with multiplication between 1 and 20
4. followed by division between 1 and 20
5. I want 10 questions and then showing a prompt at the end the shows how many points somebody got
6. time restriction of 4 minutes for the 10 questions

using the following structure, but it needs to be continued

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<HTML>
<HEAD>
<TITLE> Project</TITLE>

<SCRIPT LANGUAGE=”JavaScript”>

let Name = prompt(“Hello, What’s your name?”);
console.log(Name);

let a = Math.floor( Math.random() * 100 + 1 );
let b = Math.floor( Math.random() * 100 + 1 );
let a1 = a+b;

let c = Math.floor( Math.random() * 100 + 1 );
let d = Math.floor( Math.random() * 100 + 1 );
let c1 = c-d;

function begin1 (){
  message3.innerHTML = “”;
  a = Math.floor( Math.random() * 100 + 1 );
  b = Math.floor( Math.random() * 100 + 1 );
  a1 = a+b;
  disappear1.innerHTML = “”;
  message1.innerHTML = a + “<br/>” + “+” +”<br/>” + b + “<br/>” + “____________”;
  message2.innerHTML = “<input type = text id= ‘input001’> <button onclick = ‘submit1()’>Submit</Button>”;
  }

function submit1(){
    let answer1 = input001.value;
    show001.innerHTML = answer1;
    if (answer1 == a1) {
      message3.innerHTML = “correct”;
      message2.innerHTML = “”;
      message4.innerHTML = “<button onclick = ‘question2()’>next</button>”;
    }
    else{
      message3.innerHTML = “incorrect”;
      message2.innerHTML = “”;
      message4.innerHTML = “<button onclick = ‘begin1()’>next</button>”;
    }
}

function question2(){
  a = Math.floor( Math.random() * 100 + 1 );
  b = Math.floor( Math.random() * 100 + 1 );
  a1 = a-b;
  message1.innerHTML = c + “<br/>” + “-” +”<br/>” + d + “<br/>” + “____________”;
  message2.innerHTML = “<input type = text id= ‘input002’> <button onclick = ‘submit2()’>Submit</Button>”;
  message3.innerHTML = “”;
  show001.innerHTML = “”;
  }

function submit2(){
    let answer1 = input002.value;
    show001.innerHTML = answer1;
    if (answer1 == a1) {
      message3.innerHTML = “correct”;
      message2.innerHTML = “”;
      message4.innerHTML = “<button onclick = ‘question3()’>next</button>”;
    }
    else{
      message3.innerHTML = “incorrect”;
      message2.innerHTML = “”;
      message4.innerHTML = “<button onclick = ‘begin2()’>next</button>”;
    }
}

</script>

</head>

<BODY>

  <style>
        background-color: lightgrey;
        text-align:center   
  </style>
 
 
  <div id =”frame001″>
    <H1>Mental Arithmetic</H1>
    <p id = “message1”> </p>
    <p id = “message2”> </p>
    <p id = “show001”> </p>
    <p id = “message3”> </p>
    <p id = “message4”> </p>

    <div id = “disappear1”>
        <button onclick = “begin1()” >Begin</button>
    </div>

</body>
</html>

Forms

A . Create a user registration page that takes information from the user and provides clear error messages for incorrect input and use regular expressions to accept the correct input. Create the regular expressions to validate the form for:

The first name and last name input as characters
A valid email address
A valid phone number
A valid state and Post Code
Test your script in at least two browsers and document any debugging plus version control
B. Use the errorMessages.js form that is worked on class and with this form add the following:

Allow for the forms element label to have more than one class.
HINT: use concatenation to add the error class, and remove the error class by slicing off the text after the last space in the className Value.
Change the addToolTipHandlers() function so that it also applies appropriate event listeners to the forms label.
HINT: Start by changing the function so that it takes the elements id value as its argument, then either give each label an id value of id + label, or use previousSibling reference, as in the showTooltip() and hideTooltip() functions
Create some code for disabling the submit button while simultaneously implementing some of the suggested additions: changing the buttons class or text, adding a message beside it or creating a modal window.
Test your script in at least two browsers and document any debugging plus version control

Event Handling

1. Using the epoch.js file we were working on in class update it for the following:
a) so that a button element is clicked to update the message
b) Script tag is at the bottom of the HTML page.
c) No onclick in HTML JavaScript completely separated form HTML.
d) Program works from the bottom up – window.onload init is at the bottom of epoch.js file
e) Test your script in at least two browsers and document any debugging plus version control
2. Using the events.html & events.js files we were working on in class update them for the following:
a) so that it notifies the user when the form has been submitted and the event handlers have been
registered
b) so that it uses addEvent() for the form-submission error handler and then prevent the form from
submitting using the code also used in the membership.js
c) Script tag is at the bottom of the HTML page.
d) No onclick in HTML JavaScript completely separated form HTML.
e) Program works from the bottom up – window.onload init is at the bottom of events.js file
f) Test your script in at least two browsers and document any debugging plus version control

Complex Variables

Taking the tasks.js files, update it for the following:

Clear the task added from the text input field after the task has been added to the array
Change the task.js so that it uses join() to create a final message, instead of concatenating together multiple strings
Test the script and HTML in at least two browsers and document any debugging plus version control

Simple Variables

Create a special calculator that reads a number from the user, checks that it is an integer and performs a series of mathematical calculations

In a web page create scripts for the following scenarios. The page can have an input form or use prompt boxes to get the information from the user that is needed for the scripts.

Create a special calculator that read a number from the user, checks that it is an integer and performs a series of mathematical calculations as listed:

calculates the number’s factorial. A factorial is the product of an integer and all the integers below it; e.g., the factorial of 4 is equal to 24 (4 * 3 * 2 * 1).
Calculate the square and cube of the number. A number squared is a number that is multiplied by itself; e.g., 22 is equal to 4 (2 * 2). A number cubed is a number that is multiplied by itself twice e.g., 23 is equal to 8 (2 * 2 * 2).
Output the result into the appropriate field on the page.
Test your script in at least two browsers and document any debugging plus version control of your script

Assignment 1

I have included a zip file with the necessary files needed to complete the assignment. The Instructions are below as well.

PLEASE PROVIDE:
– Screenshot of code and output
– All of your .java files
– All of your .class files

Using the Time2.java and Time2Test.java files provided, it would be perfectly possible to represent the time internally as the total number of seconds since midnight rather than with the three integer values hour, minute, and second. Clients could use the same public methods and get the same results. Modify the Time2 class so that time is represented internally as seconds by replacing the instance variables hour, minute, and second with a single instance variable called totalSeconds, and then use Time2Test.java to test your modified Time2 class.  If your implementation is correct, the output of Time2Test should be the same as it was before you made any changes to Time2. 
Note that the three argument constructor calls setTime() which then calls the setters and thereby demonstrates, whenever the three argument constructor is called, that the setters all work.  Your solution should focus on changing setters and getters and should continue using them to get full credit for your work.
Be sure you read the lab submittal instructions to submit your lab properly.  If you dont submit your lab properly you wont get any credit for your work and you will not be allowed to resubmit your assignment.

Assignment 7

Write a generic class Pair which has two type parametersF and Seach representing the type of the first and second element of the pair, respectively. Add set and get methods for the first and second elements of the pair and be sure to demonstrate your setters/getters actually work. (Hint: The class header should be public class Pair<F, S> and the best way to demonstrate your setters is to call them from your constructor(s).)

Write a separate PairTest class to test class Pair. Create 2 Pair types and test your get and set methods on the following pair types:
    Pair<Integer, String> p1 takes Integer and String types as a pair
    Pair<String, Integer> p2 takes String and Integer

PairTest should output enough information to the terminal to show that your generic class Pair is able to set() and get() different types.

PLEASE INCLUDE:
– A screenshot of the cod and the output
– All of your .java files
– All of your .class files

python

Write a Python program that outputs the numbers from 1 to 100. However, if the
number is divisible by 3, it should output Fizz instead. If the number is divisible by 5,
it should output Buzz instead. If the number is divisible by both 3 and 5, output
Fizzbuzz. An example output for the first 36 numbers would be:
1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, 16, 17, Fizz,
19, Buzz, Fizz, 22, 23, Fizz, Buzz, 26, Fizz, 28, 29, Fizz Buzz, 31, 32, Fizz, 34, Buzz,
Fizz, …