+1 (208) 254-6996 [email protected]
  

i have the file answer but i need someone to change answer because Plagiarism

Faculty of Computer Studies

Don't use plagiarized sources. Get Your Custom Essay on
Php
Just from $13/Page
Order Essay

KSA-M275 Web Development Using PHP and MySQL

Tutor Marked Assignment – Fall 2021 2022

Cut-Off Date: to be announced Total Marks: 100

Contents

This TMA consists of 3 questions, where you are required to answer all of the questions. The TMA will be corrected by your tutor and you will be provided with a proper feedback file to understand your mistakes and avoid them on the final exam.

Plagiarism Warning:

As per AOU rules and regulations, all students are required to submit their own TMA work and avoid plagiarism. The AOU has implemented sophisticated techniques for plagiarism detection. You must provide all references in case you use and quote another person’s work in your TMA. You will be penalized for any act of plagiarism as per the AOU’s rules and regulations. For the similarity, it will be considered starting from 80% and it should be as follows:

Similarity %Deduction
30-4930% of the achieved mark
50-6950% of the achieved mark
70-8970% of the achieved mark
90-100Students get zero

Declaration of No Plagiarism by Student (to be signed and submitted by student with TMA work):

I hereby declare that this submitted TMA work is a result of my own efforts and I have not plagiarized any other person’s work. I have provided all references of information that I have used and quoted in my TMA work.

Name of Student:

Signature:

Date:

Question-1[50 marks]

The purpose of this question is to develop a web page that prompts the user to enter three values about an isosceles triangle, the left coordinates of its base, the length of its base and the triangle height. Then the web page calculates the right coordinates of its base, the coordinates of the triangle vertexand the length of the equal sides.

Hint: You can consider that the base of the isosceles triangle is always parallel to x-axis (horizontal base).

The web page should be implemented by using only the basic HTML tags and PHP codes that you learnt in this course. The final code with 2 snapshots should be provided in your answer sheet.

The designed web page should include a title, a header, an input form for entering the required values and an output form for presenting the calculated values or a suitable message when some violations are occurred. The design and the layout of the web page are left intentionally for the student to distinguish his/her TMA form other students and to show his/her creativity in designing the web page.

The PHP part should include at least two PHP function for computing the coordinates of the triangle vertices and length of the triangle sides.

Answer

<?php

if(!isset($_POST[‘x1’])) $_POST[‘x1’]=”;

if(!isset($_POST[‘y1’])) $_POST[‘y1’]=”;

if(!isset($_POST[‘x2’])) $_POST[‘x2’]=”;

if(!isset($_POST[‘y2’])) $_POST[‘y2’]=”;

if(!isset($_POST[‘y3’])) $_POST[‘x3’]=”;

if(!isset($_POST[‘y3’])) $_POST[‘y3’]=”;

if(!isset($_POST[‘side’])) $_POST[‘side’]=”;

if(!isset($_POST[‘base’])) $_POST[‘base’]=”;

if(!isset($_POST[‘height’])) $_POST[‘height’]=”;

if(!isset($_POST[‘note’])) $_POST[‘note’]=”;

if(isset($_POST[‘submit’]) )

{

$x1=$_POST[‘x1’];

$y1=$_POST[‘y1’];

$base=$_POST[‘base’];

$height=$_POST[‘height’];

if( $x1==” || $y1==” || $base==”|| $height==”)

{

$_POST[‘note’]= ” There some non filled text boxes!”;

}

else

{

if(is_numeric($x1) && is_numeric($y1) && is_numeric($base) && is_numeric($height) )

{

$_POST[‘side’]=computeSide($base,$height);

$points=computingCoordinates($x1,$y1,$base,$height);

$_POST[‘x2’]=$points[0];

$_POST[‘y2’]=$points[1];

$_POST[‘x3’]=$points[2];

$_POST[‘y3’]=$points[3];

$_POST[‘note’]= “”;

}

else

{

$_POST[‘note’]= ” There some none numerical values!”;

}

}

}

if(isset($_POST[‘clear’]) )

{

$_POST[‘x1’]=”;

$_POST[‘y1’]=”;

$_POST[‘x2’]=”;

$_POST[‘y2’]=”;

$_POST[‘x3’]=”;

$_POST[‘y3’]=”;

$_POST[‘side’]=”;

$_POST[‘base’]=”;

$_POST[‘height’]=”;

$_POST[‘note’]=”;

}

function computingCoordinates($x1,$y1,$base,$height)

{

$x2=$x1+$base;

$y2=$y1;

$x3=$x1+$base/2;

$y3=$y1+$height;

$points = array();

array_push($points, $x2);

array_push($points,$y2);

array_push($points,$x3);

array_push($points,$y3);

return $points;

}

function computeSide($base,$height)

{

return sqrt(($height*$height)+($base*$base/4));

}

?>

<html>

<head>

<title> Isosceles Triangle System </title>

<style>

h1{color:blue; font-weight:bold;}

input{color:blue;}

label{color:red;font-weight:bold;font-size:16px;}

</style>

</head>

<body>

<h1>Isosceles Triangle System : </h1>

<form method=”POST” action=”<?php echo $_SERVER[‘PHP_SELF’];?> “>

<label>left coordinates of base (V1)</label>&nbsp;&nbsp;

<label> x1 = </label>

<input type = “text” name=”x1″ size=”15″ value=”<?php echo $_POST[‘x1’] ?>”>

&nbsp;&nbsp; <label> y1 = </label>

<input type = “text” name=”y1″ size=”15″ value=”<?php echo$_POST[‘y1’] ?>”>

<br><br>

<label>The triangle height:</label>&nbsp;&nbsp;

<input type = “text” name = “height” size=”15″ value=”<?php echo $_POST[‘height’] ?>”>

<br><br>

<label>The length of base</label>&nbsp;&nbsp;

<input type = “text” name=”base” size=”15″ value=”<?php echo $_POST[‘base’] ?>”>

<br><br>

<input type = “submit” name = “submit” value=”Submit”/>

<input type = “submit” name = “clear” value=”Clear”/><br/><br/>

<label>Right coordinates of base (V2)</label>&nbsp;&nbsp;

<label> x2 = </label>

<input type = “text” name = “x2″ size=”15″ value=”<?php echo $_POST[‘x2’] ?>”>

&nbsp;&nbsp; <label> y2 = </label>

<input type = “text” name=”y2″ size=”15″ value=”<?php echo$_POST[‘y2’] ?>”>

<br><br>

<label>The coordinates of the triangle vertex (V3)</label>&nbsp;&nbsp;

<label> x3 = </label>

<input type = “text” name = “x3″ size=”15″ value=”<?php echo $_POST[‘x3’] ?>”>

&nbsp;&nbsp; <label> y3 = </label>

<input type = “text” name = “y3″ size=”15″ value=”<?php echo$_POST[‘y3’] ?>”>

<br><br>

<label> The length of the equal sides = </label>

<input type = “text” name = “side” size=”15″ value=”<?php echo$_POST[‘side’] ?>”>

<br/><br/>

<label> Explanation = </label>

<input type = “text” name=”note” size=”60″ style=”font-size:17px;” value=”<?php echo$_POST[‘note’] ?>”>

</form>

</body>

</html>

Question-2[20 marks]

Blood Bank Management Information System (BBMIS) is a database management system that provides blood to the patients who need blood. BBMIS keeps some records about blood donations that facilitate the searching for a certain blood group.

In this regard, you are asked to do some research about BBMIS, select one of the aspects that managed by BBMIS and then design two database tables about this aspect [14 marks] and another database table that represents a relation between the previous two tables [6 marks]. For each table you need to:

1- Define the objective(s) of the table.

2- Design at least five fields for the table; data type and size.

3- Determine the primary key of the table.

Answer

1-

· Donor table: to store and retrieve the donor information as id, first name, last name, date of birth and blood group.

· Patient table: to store the patient information as patient ID, first name, last name, date of birth and blood group.

· Blood table: To store the donated bloods from donors and to store any patient who took blood. The information are blood id, patient id, donor id, blood group and expire date.

2-

Donor table:

Donor_IDvarchar(10)First_NameVarchar(25)Last_NameVarchar(25)DoBdateMobileVarchar(10)BloodGroupVarchar(3)

Patient table:

Patient_IDvarchar(10)First_NameVarchar(25)Last_NameVarchar(25)DoBdateMobileVarchar(10)BloodGroupVarchar (3)

Blood table:

Blood_IDvarchar(10)BloodGroupvarchar(3)ExpireDatedatePatient_IDvarchar(10)Donor_IDvarchar(10)

3-

TablePrimary key
DonorDonor_ID
PatientPatient_ID
BloodBlood_ID
Question-3[30 marks]

A new company is planning to build a new database system for holding information about Railway Reservation System (RSS). ‘Passengers’, ‘Train Tickets’, and ‘Reservations’ are part of the information that the new company wants to store in the new database. These tables are shown below in figure 1, figure 2 and figure 3. The new company intends to use MySQL for building the new database.

Passenger IDPassenger NamePassenger AgePassenger Gender
824Ahmad56Male
585Bushra22Female
826Aziz44Male
647Bashar23Male
492Karima60Female
405Dawoud52Male
812Farid63Male
743Fawaz38Male
413Fawzi56Male
703Zahra37Female

Figure 1: Passengers table

Ticket IDDate of FlightDeparture TimeLanding TimeDestination
2492627/11/202018:5922:00Al-Dammam
705478/10/202119:071:34Tabuk
7225626/1/202123:411:20Riyadh
1874420/7/202118:1822:20Riyadh
4483510/11/202012:5515:20Dhahran
5945911/5/202113:2819:05Jeddah
2254629/12/202018:142:42Riyadh
315001/6/202114:0618:29Jeddah
4054211/11/202011:2414:34Dhahran
3969612/1/202123:424:47Al-Dammam

Figure 2: Train Tickets table

Reservation IDPassenger IDTicket IDDate Reservation
853731703448355/11/2020
627567826405429/11/2020
4875868242492620/11/2020
4722588122254627/12/2020
1535347033969610/1/2021
1668208267225619/01/2021
490694824594595/5/2021
3699877433150025/05/2021
2475246471874419/07/2021
151989703705471/10/2021

Figure 3: Reservations table

Based on the above three tables, answer the following 6 questions: You need to provide for every SQL a screen shot that shows the implementation of the SQL and the result of that SQL.

1- Write an SQL statement for creating the Passengers table that is shown in figure 1. No need to write any SQL statement for adding any record to the Passengers table.

[5 marks]

2- Write an SQL statement for adding one record to the Passengers table that was created in question-1 above. The added record should be one of the records that are given in the Passengers table. [5 marks]

3- Write an SQL statement to list the names of all males passengers whose age between 30 and 50. [5 marks]

4- Write an SQL statement to list the names of all passengers who made reservations in 2020. [5 marks]

5- Write an SQL statement to list the names of all passengers whose departure time was before 16:00 and destination address is Jeddah or Riyadh. [5 marks]

6- Write an SQL statement to list the names of all passengers whose destination address is Al-Dammam. [5 marks]

Answer

1-

Create table Passengers (

Passenger_ID int(3) primary key,

Passenger_Name varchar(20) not null,

Passenger_Age int(3) not null,

Passenger_Gender varchar(6) not null

)

2-

Insert into Passengers values (824,’Ahmad’,56,’Male’);

3-

Select Passenger_Name

From Passengers

Where Passenger_Gender=’Male’

And Passenger_Age between 30 and 50

4-

Select Passenger_Name

From Passengers, Reservations

Where Passengers.Passenger_ID=reservations.Passenger_ID

and Date_Reservation BETWEEN ‘2020/1/1’ and ‘2020/12/31’

5-

Select Passenger_Name

From Passengers, Reservations ,train_tickets

Where passengers.Passenger_ID=reservations.Passenger_ID

and reservations.Ticket_ID=train_tickets.Ticket_ID

and Departure_Time <’16:00′

and Destination in (‘Jeddah’,’Riyadh’)

6-

Select Passenger_Name

From Passengers, Reservations ,Train_tickets

Where passengers.Passenger_ID=reservations.Passenger_ID

and reservations.Ticket_ID=train_tickets.Ticket_ID

and Destination =’Al-Dammam’

——

قبل الخطوات 3 الى 6

Insert into Passengers values (824,’Ahmad’,56,’Male’);

Insert into Passengers values (585,’Bushra’,22,’Female’);

Insert into Passengers values (826,’Aziz’,44,’Male’);

Insert into Passengers values (647,’Bashar’,23,’Male’);

Insert into Passengers values (492,’Karima’,60,’Female’);

Insert into Passengers values (405,’Dawoud’,52,’Male’);

Insert into Passengers values (812,’Farid’,63,’Male’);

Insert into Passengers values (743,’Fawaz’,38,’Male’);

Insert into Passengers values (413,’Fawazi’,56,’Male’);

Insert into Passengers values (703,’Zahra’,37,’Female’);

Create table Train_Tickets(

Ticket_ID int primary key, Date_of_Flight date,

Departure_Time time,

Landing_Time time, Destination char(20)) ;

Insert into Train_Tickets values(24926,’2020/11/27′,’18:59′,’22:00′,’Al-Dammam’);

Insert into Train_Tickets values(70547,’2021/10/08′,’19:07′,’1:34′,’Tabuk’);

Insert into Train_Tickets values(72256,’2021/1/26′,’23:41′,’1:20′,’Riyadh’);

Insert into Train_Tickets values(18744,’2021/7/20′,’18:18′,’22:20′,’Riyadh’);

Insert into Train_Tickets values(44835,’2020/10/11′,’12:55′,’15:20′,’Dhahran’);

Insert into Train_Tickets values(59459,’2021/5/11′,’13:28′,’19:05′,’Jeddah’);

Insert into Train_Tickets values(22546,’2020/12/29′,’18:14′,’2:42′,’Riyadh’);

Insert into Train_Tickets values(31500,’2021/6/1′,’14:06′,’18:29′,’Jeddah’);

Insert into Train_Tickets values(40542,’2020/11/11′,’11:24′,’14:34′,’Dhahran’);

Insert into Train_Tickets values(39696,’2021/1/12′,’23:42′,’4:47′,’Al-Dammam’);

Create table Reservations (

Reservation_ID int primary key,

Passenger_ID int ,

Ticket_ID int ,

Date_Reservation date

);

Insert into Reservations values(853731,703,44835,’2020/11/5′);

Insert into Reservations values(627567,826,40542,’2020/11/9′);

Insert into Reservations values(487586,824, 24926,’2020/11/20′);

Insert into Reservations values(472258,812, 22546,’2020/12/27′);

Insert into Reservations values(153534,703, 39696,’2021/1/10′);

Insert into Reservations values(166820,826, 72256,’2021/1/19′);

Insert into Reservations values(490694,824, 59459,’2021/5/5′);

Insert into Reservations values(369987,743, 31500,’2021/5/25′);

Insert into Reservations values(247524,647, 18744,’2021/7/19′);

Insert into Reservations values(151989,703, 70547,’2021/10/1′);

M275-TMA Page -3- Fall 2021 2022

Order your essay today and save 10% with the discount code ESSAYHELP