OneCompiler

fish

94

b2.php

<?php session_start(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!isset($_SESSION['employee_details'])) { $_SESSION['employee_details'] = [ 'Eno' => $_POST['eno'], 'Ename' => $_POST['ename'], 'Address' => $_POST['address'] ]; header('Location: ' . $_SERVER['PHP_SELF']); exit(); } elseif (!isset($_SESSION['earning_details'])) { $_SESSION['earning_details'] = [ 'Basic' => $_POST['basic'], 'DA' => $_POST['da'], 'HRA' => $_POST['hra'] ]; header('Location: ' . $_SERVER['PHP_SELF']); exit(); } } if (isset($_SESSION['employee_details']) && isset($_SESSION['earning_details'])) { $employeeDetails = $_SESSION['employee_details']; $earningDetails = $_SESSION['earning_details']; $totalEarnings = $earningDetails['Basic'] + $earningDetails['DA'] + $earningDetails['HRA']; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Employee Details</title> </head> <body> <?php if (!isset($employeeDetails) || !isset($earningDetails)) : ?> <h2>Employee Details</h2> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label for="eno">Employee Number:</label> <input type="text" name="eno" required><br> <label for="ename">Employee Name:</label> <input type="text" name="ename" required><br> <label for="address">Address:</label> <input type="text" name="address" required><br> <input type="submit" value="Next"> </form> <?php elseif (!isset($totalEarnings)) : ?> <h2>Earning Details</h2> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label for="basic">Basic:</label> <input type="text" name="basic" required><br> <label for="da">DA:</label> <input type="text" name="da" required><br> <label for="hra">HRA:</label> <input type="text" name="hra" required><br> <input type="submit" value="Next"> </form> <?php else : ?> <h2>Employee Information</h2> <p><strong>Employee Number:</strong> <?php echo $employeeDetails['Eno']; ?></p> ?></p> ></p> <p><strong>Employee Name:</strong> <?php echo $employeeDetails['Ename']; <p><strong>Address:</strong> <?php echo $employeeDetails['Address']; ? <p><strong>Basic:</strong> <?php echo $earningDetails['Basic']; ?></p> <p><strong>DA:</strong> <?php echo $earningDetails['DA']; ?></p> <p><strong>HRA:</strong> <?php echo $earningDetails['HRA']; ?></p> <p><strong>Total Earnings:</strong> <?php echo $totalEarnings; ?></p> <?php endif; ?> </body>

Importpandasaspd
on.
Importrandom
Fromsklearn.l
inear_modelimportLi
nearRegressi
#createthedataset
Fish_speci
es=[‘Tuna’
Weights=[]
Foriinrange(50):
Fish_weight=[]
Forjinrange(7):
,‘Salmon’
,‘Trout’
Weight=random.randint(1,20)
Fish_weight.
append(weight)
Weights.append(fi
sh_weight)
Df=pd.DataFrame(weights,col
on
,‘Bass’
,‘Sardi
ne’,‘
umns=fish_species)
#createthelinearregressi
onmodel
X=df.iloc[:
,:-1]#independentvari
ables
Y=df.iloc[:
,-1]#targetvari
able
Model=LinearRegression()
Model.fi
t(X,y)
#predicttheweightofanewfishspecies
New_fish=[[10,12,15,7,4,8]]#exampl
Predicted_wei
einput
ght=model.predict(new_fi
sh)
Print(“Predi
ctedweight:”,predi
cted_weight