Home  >  Esami di Stato  >  Prova scritta esame di stato  >  Prima Simulazione 2020

Prova scritta simulazione esame di stato 2019 - 28 febbraio 2019


Traccia della prima simulazione 2019 che chiede di realizzare il sistema informatico per un servizio di noleggio biciclette.

Il Comune di una città europea di medie dimensioni vuole implementare, per sostenere politiche di mobilità sostenibile, un servizio di noleggio di biciclette attraverso stazioni di “noleggio e riconsegna” dislocate in diversi punti della città.
Questa è la mia soluzione in formato pdf.

Apri PDF   Download PDF



Il sorgente PHP per la risoluzione del quesito uno della seconda parte.


Download del codice
<html>
<head>
	<title>Esempio traccia 2019</title>
</head>
<body>
	<?
	$stazione=$_POST['stazione'];
	$conn = new mysqli("localhost","root","", "2019");
	if ($conn->connect_error) {
		die("Connessione fallita con errore: " . $conn->connect_error);
	}
  $query = "select stazione.id as id, slot.id_bicicletta as bici from slot,
	stazione where slot.id_stazione = stazione.id and stato = 'occupato' and stazione.id= '".$stazione."'";
	$result = $conn->query($query);
	$i = 0;
	if ($result->num_rows > 0) {
		echo "<table border=\"1\">";
		echo "<tr><td bgcolor=\"#FFFFFF\">Codice Stazione</td><td  bgcolor=\"#FFFFFF\">Bici</td></tr>";

		while($row = $result->fetch_assoc()) {
			if($i % 2 == 0){
				echo "<tr><td bgcolor=\"#BBBBBB\">&nbsp;".$row['id'];
				echo "</td><td  bgcolor=\"#BBBBBB\">&nbsp;".$row['bici']."</tr>";
			}
			else{
				echo "<tr><td bgcolor=\"#DDDDDD\">&nbsp;".$row['id'];
				echo "</td><td  bgcolor=\"#DDDDDD\">&nbsp;".$row['bici']"</tr>";
			}
			$i++;
		}
	} else {
		echo "0 results";
	}
	echo "</table>";
	$conn->close();
	?>
</body>
</html>

Il codice SQL per la creazione del database.


Download del codice
-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Feb 28, 2019 at 07:17 PM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.3.1

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `2019`
--

-- --------------------------------------------------------

--
-- Table structure for table `bicicletta`
--

CREATE TABLE `bicicletta` (
  `id` int(11) NOT NULL,
  `modello` varchar(64) NOT NULL,
  `anno_di_produzione` int(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------

--
-- Table structure for table `noleggio`
--

CREATE TABLE `noleggio` (
  `id` int(11) NOT NULL,
  `data_inizio` date NOT NULL,
  `data_fine` date DEFAULT NULL,
  `costo` date DEFAULT NULL,
  `id_utente` int(11) NOT NULL,
  `id_bicicletta` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------

--
-- Table structure for table `slot`
--

CREATE TABLE `slot` (
  `id` int(11) NOT NULL,
  `stato` set('libero','occupato') NOT NULL,
  `id_bicicletta` int(11) DEFAULT NULL,
  `id_stazione` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------

--
-- Table structure for table `stazione`
--

CREATE TABLE `stazione` (
  `id` int(11) NOT NULL,
  `indirizzo` varchar(128) NOT NULL,
  `cap` varchar(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------

--
-- Table structure for table `utenti`
--

CREATE TABLE `utenti` (
  `id` int(11) NOT NULL,
  `nome` varchar(64) NOT NULL,
  `cognome` varchar(64) NOT NULL,
  `cap` varchar(5) NOT NULL,
  `indirizzo` varchar(128) NOT NULL,
  `num_carta_di_credito` varchar(16) NOT NULL,
  `cellulare` varchar(11) NOT NULL,
  `mail` varchar(64) NOT NULL,
  `data_nascita` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


--
-- Indexes for dumped tables
--

--
-- Indexes for table `bicicletta`
--
ALTER TABLE `bicicletta`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `noleggio`
--
ALTER TABLE `noleggio`
  ADD PRIMARY KEY (`id`),
  ADD KEY `bici` (`id_bicicletta`),
  ADD KEY `ut` (`id_utente`);

--
-- Indexes for table `slot`
--
ALTER TABLE `slot`
  ADD PRIMARY KEY (`id`),
  ADD KEY `st` (`id_stazione`),
  ADD KEY `bic` (`id_bicicletta`);

--
-- Indexes for table `stazione`
--
ALTER TABLE `stazione`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `utenti`
--
ALTER TABLE `utenti`
  ADD PRIMARY KEY (`id`);

--
-- Constraints for dumped tables
--

--
-- Constraints for table `noleggio`
--
ALTER TABLE `noleggio`
  ADD CONSTRAINT `bici` FOREIGN KEY (`id_bicicletta`) REFERENCES `bicicletta` (`id`),
  ADD CONSTRAINT `ut` FOREIGN KEY (`id_utente`) REFERENCES `utenti` (`id`);

--
-- Constraints for table `slot`
--
ALTER TABLE `slot`
  ADD CONSTRAINT `bic` FOREIGN KEY (`id_bicicletta`) REFERENCES `bicicletta` (`id`),
  ADD CONSTRAINT `st` FOREIGN KEY (`id_stazione`) REFERENCES `stazione` (`id`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;