SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Nome: Caroline Silva Pimentel
Nome: Nádia Rodrigues
Nome: Rodrigo Naoki Yanase

RA: 121681023
RA: 121681008
RA: 121681018

Lista VIII - Engenharia de Software III

Prof. MSc. Wilson Vendramel
Novembro/2013
1)
2)

3)
4)

5)
6)
package java.Pagamento;
public class BoletoBancario extends Pagamento {
public void realizaPagamento(String pedido) {
}
}
public class CartaoCredito extends Pagamento {
public void geraFatura(String pedido) {
}
}
public abstract class Pagamento {
}

7)

8)
Cliente(idCli, nomeCli, cpfCli)
UsuEspecial(idUsu, nomeUsu, senhaUsu)
Livro(idLiv, titLiv, isbnLiv, editoraLiv, dtPublLiv, catLiv, resumoLiv, precoLiv)

9)
10)
CREATE TABLE Cliente (
idCli INT NOT NULL,
nomeCli CHAR(30),
cpfCli CHAR(9)
);
ALTER TABLE Cliente ADD CONSTRAINT PK_Cliente PRIMARY KEY (idCli);

CREATE TABLE Livro (
idLiv INT NOT NULL,
titLiv CHAR(30),
isbnLiv INT,
editoraLiv CHAR(20),
dtPublLiv DATE,
catLiv CHAR(20),
resumoLiv CHAR(60),
precoLiv DECIMAL(10)
);
ALTER TABLE Livro ADD CONSTRAINT PK_Livro PRIMARY KEY (idLiv);

CREATE TABLE UsuEspecial (
idUsu INT NOT NULL,
nomeUsu CHAR(30),
senhaUsu CHAR(10)
);
ALTER TABLE UsuEspecial ADD CONSTRAINT PK_UsuEspecial PRIMARY KEY (idUsu);

11)
12)

13)
14)

15)
package java.Usuario;
public class ClienteDAO implements IClienteDAO {
private Identificacao identificacao;
}
public class FormWeb {
private Cliente cliente;
public void conclui(string pedido) {
}
}
public interface IClienteDAO {
}
public class Identificacao {
private String login;
private String senha;
private Cliente cliente;
private PagPessoal pagPessoal;
private ClienteDAO clienteDAO;
public void valida(string login, string senha) {
}
public void cria(String login, String senha) {
}
}
public interface IUsuEspecialDAO {
}
public class PagPessoal {
private String estadoPedido;
private String pedidoAnterior;
private Identificacao identificacao;
private UsuEspecialDAO usuEspecialDAO;
public void pesquisa(string pedidoAnterior) {
}
}
public class UsuEspecialDAO implements IUsuEspecialDAO {
private PagPessoal pagPessoal;
}

16)
Cliente(id, nomeCli, enderecoCli, telefoneCli)
Animal(idAni, nomeAni, dtNascAni, sexoAni)
CliPossuiAni(idAni, idCli)
Veterinario(idVet, nomeVet)
VetTrataAni(idAni, idVet)

17)

18)
CREATE TABLE Animal (
idAni INT NOT NULL,
nomeAni VARCHAR(20),
dtNascAni DATE,
sexoAni CHAR(1)
);
ALTER TABLE Animal ADD CONSTRAINT PK_Animal PRIMARY KEY (idAni);

CREATE TABLE Cliente (
idCli INT NOT NULL,
nomeCli VARCHAR(20),
enderecoCli VARCHAR(30),
telefoneCli VARCHAR(10)
);
ALTER TABLE Cliente ADD CONSTRAINT PK_Cliente PRIMARY KEY (idCli);

CREATE TABLE CliPossuiAni (
idCli INT NOT NULL,
idAni INT NOT NULL
);
ALTER TABLE CliPossuiAni ADD CONSTRAINT PK_CliPossuiAni PRIMARY KEY
(idCli,idAni);

CREATE TABLE Veterinario (
idVet INT NOT NULL,
nomeVet VARCHAR(20)
);
ALTER TABLE Veterinario ADD CONSTRAINT PK_Veterinario PRIMARY KEY (idVet);

CREATE TABLE VetTrataAni (
idAni INT NOT NULL,
idVet INT NOT NULL
);
ALTER TABLE VetTrataAni ADD CONSTRAINT PK_VetTrataAni PRIMARY KEY
(idAni,idVet);

ALTER TABLE CliPossuiAni ADD CONSTRAINT FK_CliPossuiAni_0 FOREIGN KEY (idCli)
REFERENCES Cliente (idCli);
ALTER TABLE CliPossuiAni ADD CONSTRAINT FK_CliPossuiAni_1 FOREIGN KEY (idAni)
REFERENCES Animal (idAni);

ALTER TABLE VetTrataAni ADD CONSTRAINT FK_VetTrataAni_0 FOREIGN KEY (idAni)
REFERENCES Animal (idAni);
ALTER TABLE VetTrataAni ADD CONSTRAINT FK_VetTrataAni_1 FOREIGN KEY (idVet)
REFERENCES Veterinario (idVet);

19)
20)
21)

22)

23)
package java.Envolvido;
public class Cliente {
private Veterinario veterinario;
private IVeterinarioDAO iVeterinarioDAO;
}
public class ClienteDAO implements IClienteDAO {
}
public interface IClienteDAO {
private Veterinario veterinario;
}
public interface IVeterinarioDAO {
private Cliente cliente;
}
public class Veterinario {
private Cliente cliente;
private IClienteDAO iClienteDAO;
}
public class VeterinarioDAO implements IVeterinarioDAO {
}

24)
Cliente(id, nomeCli, enderecoCli, telefoneCli, cpfCli, cnpjCli, tipoProcCli)
CliProcessaPC(id, idCli, idPC, descrição, veredicto)
ParteContraria(id, nomePC, telefonePC, cpfPC)
Advogado(id, oab, nomeAdv, telefoneAdv)
CliPossuiAdv(id, idCli, idAdv)

25)

26)
CREATE TABLE Advogado (
idAdv int PRIMARY KEY NOT NULL,
oab int,
nomeAdv CHAR(25),
telefoneAdv CHAR(10)
);
ALTER TABLE Advogado ADD CONSTRAINT PK_Advogado PRIMARY KEY (idAdv);

CREATE TABLE Cliente (
idCli int PRIMARY KEY NOT NULL,
nomeCli CHAR(25),
enderecoCli CHAR(30),
telefoneCli CHAR(10),
cpfCli CHAR(9),
cnpjCli INT,
tipoProcCli CHAR(50)
);
ALTER TABLE Cliente ADD CONSTRAINT PK_Cliente PRIMARY KEY (idCli);

CREATE TABLE ParteContraria (
idPC int PRIMARY KEY NOT NULL,
nomePC CHAR(25),
telefonePC CHAR(10),
cpfPC CHAR(9)
);
ALTER TABLE ParteContraria ADD CONSTRAINT PK_ParteContraria PRIMARY KEY (idPC);

CREATE TABLE CliPossuiAdv (
idCliAdv int PRIMARY KEY NOT NULL,
idPC int NOT NULL,
idAdv int NOT NULL,
idCli int NOT NULL
);
ALTER TABLE CliPossuiAdv ADD CONSTRAINT PK_CliPossuiAdv PRIMARY KEY
(idCliAdv,idPC,idAdv ,idCli);

CREATE TABLE CliProcessaPC (
idCliPC int PRIMARY KEY NOT NULL,
idCli int NOT NULL,
idPC int NOT NULL,
descricao CHAR(10),
veredicto CHAR(10)
);
ALTER TABLE CliProcessaPC ADD CONSTRAINT PK_CliProcessaPC PRIMARY KEY
(idCliPC,idCli ,idPC);

ALTER TABLE CliPossuiAdv ADD CONSTRAINT FK_CliPossuiAdv_0 FOREIGN KEY (idPC)
REFERENCES ParteContraria (idPC);
ALTER TABLE CliPossuiAdv ADD CONSTRAINT FK_CliPossuiAdv_1 FOREIGN KEY (idAdv )
REFERENCES Advogado (idAdv);
ALTER TABLE CliPossuiAdv ADD CONSTRAINT FK_CliPossuiAdv_2 FOREIGN KEY (idCli )
REFERENCES Cliente (idCli);

ALTER TABLE CliProcessaPC ADD CONSTRAINT FK_CliProcessaPC_0 FOREIGN KEY (idCli
) REFERENCES Cliente (idCli);
ALTER TABLE CliProcessaPC ADD CONSTRAINT FK_CliProcessaPC_1 FOREIGN KEY (idPC )
REFERENCES ParteContraria (idPC);
27)
28)

29)
30)

31)
package java.Envolvido;
public class Advogado {
private Cliente cliente;
private Advogado advogado;
private Advogado advogado;
}
public class AdvogadoDAO implements IAdvogadoDAO {
}
public class
private
private
private
}

Cliente {
IAdvogadoDAO iAdvogadoDAO;
Advogado advogado;
IParteContrariaDAO iParteContrariaDAO;

public class ClienteDAO implements IClienteDAO {
}
public interface IAdvogadoDAO {
private Cliente cliente;
}
public interface IClienteDAO {
private ParteContraria parteContraria;
}
public interface IParteContrariaDAO {
private Cliente cliente;
}
public class ParteContraria {
private IClienteDAO iClienteDAO;
}
public class ParteContrariaDAO implements IParteContrariaDAO {
}
32)
a)

b)
Unidade(idUni, região, endereço)
Venda(idVend, valor, idUni)
Produto(idProd, preco)
VendProd(id, idProd, idVend)
Porca(idProd, preco, diametro)
Parafuso(idProd, preco, tamanho)
Pino(idProd, preco, tamanho)
Arruela(idProd, preco, diametro)

c)

CREATE TABLE Venda (
valor DOUBLE
);

CREATE TABLE Produto (
preco VARCHAR(10)
);

CREATE TABLE Unidade (
regiao VARCHAR(10),
endereco VARCHAR(10)
);

CREATE TABLE Arruela (
diametro INT
);

CREATE TABLE Parafuso (
tamanho INT
);

CREATE TABLE Pino (
tamanho INT
);

CREATE TABLE Porca (
diametro INT
);

33)
a)

b)
c)
NomeCientifico(idNomeCientifico, idGenero, nomeCientifico)
SerVivo(id, idNomeCientifico, nomePopular, idGenero, idFamilia, idClasse, idReino, idFilo)
CategoriaTaxonomica(idSerVivo)
Genero(idGenero, nomeGenero)
Familia(idFamilia, nomeFamilia)
Classe(idClasse, nomeClasse)
Reino(idReino, nomeReino)
Filo(idFilo, nomeFilo)

d)
A vantagem da Gen/Espec é que ela torna mais fácil a compreensão de suas filhas, deixando claro que nome
científico, gênero, família, classe, reino e filo são tipos de categorias taxonômicas. O problema é que essa relação
poderia ser mais resumida, criando um atributo “tipo” na classe categoria taxonômica, que receberia os valores de
suas filhas. Por exemplo:

e)

CREATE TABLE Classe (
idClasse int PRIMARY KEY NOT NULL,
nomeClasse CHAR(20)
);
ALTER TABLE Classe ADD CONSTRAINT PK_Classe PRIMARY KEY (idClasse);

CREATE TABLE Familia (
idFamilia int PRIMARY KEY NOT NULL,
nomeFamilia CHAR(20)
);
ALTER TABLE Familia ADD CONSTRAINT PK_Familia PRIMARY KEY (idFamilia);

CREATE TABLE Filo (
idFilo int PRIMARY KEY NOT NULL,
nomeFilo CHAR(20)
);
ALTER TABLE Filo ADD CONSTRAINT PK_Filo PRIMARY KEY (idFilo);

CREATE TABLE Genero (
idGenero int PRIMARY KEY NOT NULL,
nomeGenero CHAR(20)
);
ALTER TABLE Genero ADD CONSTRAINT PK_Genero PRIMARY KEY (idGenero);

CREATE TABLE Reino (
idReino int PRIMARY KEY NOT NULL,
nomeReino CHAR(20)
);
ALTER TABLE Reino ADD CONSTRAINT PK_Reino PRIMARY KEY (idReino);

CREATE TABLE CategoriaTaxonomica (
idSerVivo int PRIMARY KEY NOT NULL,
idGenero int
);
ALTER TABLE CategoriaTaxonomica ADD CONSTRAINT PK_CategoriaTaxonomica PRIMARY
KEY (idSerVivo);

CREATE TABLE SerVivo (
idSerVivo int PRIMARY KEY NOT NULL,
idNomeCientifico VARCHAR(25) NOT NULL,
idGenero int NOT NULL,
idFamilia int NOT NULL,
idClasse int NOT NULL,
idReino int NOT NULL,
idFilo int NOT NULL,
nomePopular CHAR(30)
);
ALTER TABLE SerVivo ADD CONSTRAINT PK_SerVivo PRIMARY KEY
(idSerVivo,idNomeCientifico,idGenero,idFamilia,idClasse,idReino,idFilo);

CREATE TABLE NomeCientifico (
idNomeCientifico int PRIMARY KEY NOT NULL,
nomeCientifico CHAR(30)
);
ALTER TABLE NomeCientifico ADD CONSTRAINT PK_NomeCientifico PRIMARY KEY
(idNomeCientifico);

ALTER TABLE CategoriaTaxonomica ADD CONSTRAINT FK_CategoriaTaxonomica_0 FOREIGN
KEY (idGenero) REFERENCES Genero (idGenero);

f)
/* criando as tabelas */
create table NomeCientifico(
idNomeCientifico int primary key auto_increment not null,
idGenero int,
constraint fk_idGenero foreign key (idGenero) references Genero (idGenero),
nomeCientifico varchar(30))
create table SerVivo(
idSerVivo int primary key auto_increment not null,
nomePopular varchar(30),
idNomeCientifico int,
idGenero int,
idFamilia int,
idClasse int,
idReino int,
idFilo int,
constraint fk_idNomeCientifico foreign key (idNomeCientifico) references
NomeCientifico (idNomeCientifico),
constraint fk_idGenero foreign key (idGenero) references Genero (idGenero),
constraint fk_idFamilia foreign key (idFamilia) references Familia (idFamilia),
constraint fk_idClasse foreign key (idClasse) references Classe (idClasse),
constraint fk_idReino foreign key (idReino) references Reino (idReino),
constraint fk_idFilo foreign key (idFilo) references Filo (idFilo))
create table CategoriaTaxonomica(
idSerVivo int,
constraint fk_idSerVivo foreign key (idSerVivo) references SerVivo (idSerVivo))
create table Genero(
idGenero int primary key auto_increment not null,
nomeGenero varchar(30))
create table Familia(
idFamilia int primary key auto_increment not null,
nomeFamilia varchar(30))
create table Classe(
idClasse int primary key auto_increment not null,
nomeClasse varchar(30))
create table Reino(
idReino int primary key auto_increment not null,
nomeReino varchar(30))
create table Filo(
idFilo int primary key auto_increment not null,
nomeFilo varchar(30))
/* populando as tabelas com os dados de cachorro */
insert into SerVivo values(01, ‘cachorro’, 01, 01, 01, 01, 01, 01)
insert into NomeCientifico values (01, 01, ‘canis lupus familiaris’)
insert into CategoriaTaxonomica values (01)
insert into Genero values (01, ‘canis’)
insert into Familia values 01, ‘canidae’)
insert into Classe values (01, ‘mammalia’)
insert into Reino values (01, ‘animalia’)
insert into Filo values (01, ‘chordata’)
/* populando as tabelas com os dados de humano */
insert into SerVivo values(02, ‘humano’, 02, 02, 02, 02, 02, 02)
insert into NomeCientifico values (02, 02, ‘homo sapiens’)
insert into CategoriaTaxonomica values (02)
insert into Genero values (02, ‘homo’)
insert into Familia values 02, ‘hominidae’)
insert into Classe values (02, ‘mammalia’)
insert into Reino values (02, ‘animalia’)
insert into Filo values (02, ‘chordata’)

g)
/* pesquisando dados do cachorro */
SELECT
SerVivo.nomePopular,
NomeCientifico.nomeCientifico,
Genero.nomeGenero,
Familia.nomeFamilia,
Classe.nomeClasse,
Reino.nomeReino,
Filo.nomeFilo
FROM SerVivo
INNER JOIN NomeCientifico
ON SerVivo.idNomeCientifico = NomeCientifico.idNomeCientifico
INNER JOIN Genero
ON SerVivo.idGenero = Genero.idGenero
INNER JOIN Familia
ON SerVivo.idFamilia = Familia.idFamilia
INNER JOIN Classe
ON SerVivo.idClasse = Classe.idClasse
INNER JOIN Reino
ON SerVivo.idReino = Reino.idReino
INNER JOIN Filo
ON SerVivo.idFilo = Filo.idFilo
WHERE idSerVivo = 1;

/* pesquisando dados do humano */
SELECT
SerVivo.nomePopular,
NomeCientifico.nomeCientifico,
Genero.nomeGenero,
Familia.nomeFamilia,
Classe.nomeClasse,
Reino.nomeReino,
Filo.nomeFilo
FROM SerVivo
INNER JOIN NomeCientifico
ON SerVivo.idNomeCientifico = NomeCientifico.idNomeCientifico
INNER JOIN Genero
ON SerVivo.idGenero = Genero.idGenero
INNER JOIN Familia
ON SerVivo.idFamilia = Familia.idFamilia
INNER JOIN Classe
ON SerVivo.idClasse = Classe.idClasse
INNER JOIN Reino
ON SerVivo.idReino = Reino.idReino
INNER JOIN Filo
ON SerVivo.idFilo = Filo.idFilo
WHERE idSerVivo = 2;

Mais conteúdo relacionado

Destaque

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Lista de alunos e códigos de disciplina

  • 1. Nome: Caroline Silva Pimentel Nome: Nádia Rodrigues Nome: Rodrigo Naoki Yanase RA: 121681023 RA: 121681008 RA: 121681018 Lista VIII - Engenharia de Software III Prof. MSc. Wilson Vendramel Novembro/2013
  • 2. 1)
  • 5. 6) package java.Pagamento; public class BoletoBancario extends Pagamento { public void realizaPagamento(String pedido) { } } public class CartaoCredito extends Pagamento { public void geraFatura(String pedido) { } } public abstract class Pagamento { } 7) 8) Cliente(idCli, nomeCli, cpfCli) UsuEspecial(idUsu, nomeUsu, senhaUsu) Livro(idLiv, titLiv, isbnLiv, editoraLiv, dtPublLiv, catLiv, resumoLiv, precoLiv) 9)
  • 6. 10) CREATE TABLE Cliente ( idCli INT NOT NULL, nomeCli CHAR(30), cpfCli CHAR(9) ); ALTER TABLE Cliente ADD CONSTRAINT PK_Cliente PRIMARY KEY (idCli); CREATE TABLE Livro ( idLiv INT NOT NULL, titLiv CHAR(30), isbnLiv INT, editoraLiv CHAR(20), dtPublLiv DATE, catLiv CHAR(20), resumoLiv CHAR(60), precoLiv DECIMAL(10) ); ALTER TABLE Livro ADD CONSTRAINT PK_Livro PRIMARY KEY (idLiv); CREATE TABLE UsuEspecial ( idUsu INT NOT NULL, nomeUsu CHAR(30), senhaUsu CHAR(10) ); ALTER TABLE UsuEspecial ADD CONSTRAINT PK_UsuEspecial PRIMARY KEY (idUsu); 11)
  • 7.
  • 9. 14) 15) package java.Usuario; public class ClienteDAO implements IClienteDAO { private Identificacao identificacao; } public class FormWeb { private Cliente cliente; public void conclui(string pedido) { } } public interface IClienteDAO { } public class Identificacao { private String login; private String senha; private Cliente cliente; private PagPessoal pagPessoal; private ClienteDAO clienteDAO; public void valida(string login, string senha) { } public void cria(String login, String senha) { } } public interface IUsuEspecialDAO { }
  • 10. public class PagPessoal { private String estadoPedido; private String pedidoAnterior; private Identificacao identificacao; private UsuEspecialDAO usuEspecialDAO; public void pesquisa(string pedidoAnterior) { } } public class UsuEspecialDAO implements IUsuEspecialDAO { private PagPessoal pagPessoal; } 16) Cliente(id, nomeCli, enderecoCli, telefoneCli) Animal(idAni, nomeAni, dtNascAni, sexoAni) CliPossuiAni(idAni, idCli) Veterinario(idVet, nomeVet) VetTrataAni(idAni, idVet) 17) 18) CREATE TABLE Animal ( idAni INT NOT NULL, nomeAni VARCHAR(20), dtNascAni DATE, sexoAni CHAR(1) ); ALTER TABLE Animal ADD CONSTRAINT PK_Animal PRIMARY KEY (idAni); CREATE TABLE Cliente ( idCli INT NOT NULL, nomeCli VARCHAR(20), enderecoCli VARCHAR(30), telefoneCli VARCHAR(10) );
  • 11. ALTER TABLE Cliente ADD CONSTRAINT PK_Cliente PRIMARY KEY (idCli); CREATE TABLE CliPossuiAni ( idCli INT NOT NULL, idAni INT NOT NULL ); ALTER TABLE CliPossuiAni ADD CONSTRAINT PK_CliPossuiAni PRIMARY KEY (idCli,idAni); CREATE TABLE Veterinario ( idVet INT NOT NULL, nomeVet VARCHAR(20) ); ALTER TABLE Veterinario ADD CONSTRAINT PK_Veterinario PRIMARY KEY (idVet); CREATE TABLE VetTrataAni ( idAni INT NOT NULL, idVet INT NOT NULL ); ALTER TABLE VetTrataAni ADD CONSTRAINT PK_VetTrataAni PRIMARY KEY (idAni,idVet); ALTER TABLE CliPossuiAni ADD CONSTRAINT FK_CliPossuiAni_0 FOREIGN KEY (idCli) REFERENCES Cliente (idCli); ALTER TABLE CliPossuiAni ADD CONSTRAINT FK_CliPossuiAni_1 FOREIGN KEY (idAni) REFERENCES Animal (idAni); ALTER TABLE VetTrataAni ADD CONSTRAINT FK_VetTrataAni_0 FOREIGN KEY (idAni) REFERENCES Animal (idAni); ALTER TABLE VetTrataAni ADD CONSTRAINT FK_VetTrataAni_1 FOREIGN KEY (idVet) REFERENCES Veterinario (idVet); 19)
  • 12. 20)
  • 13. 21) 22) 23) package java.Envolvido; public class Cliente { private Veterinario veterinario; private IVeterinarioDAO iVeterinarioDAO; } public class ClienteDAO implements IClienteDAO { } public interface IClienteDAO { private Veterinario veterinario; } public interface IVeterinarioDAO { private Cliente cliente;
  • 14. } public class Veterinario { private Cliente cliente; private IClienteDAO iClienteDAO; } public class VeterinarioDAO implements IVeterinarioDAO { } 24) Cliente(id, nomeCli, enderecoCli, telefoneCli, cpfCli, cnpjCli, tipoProcCli) CliProcessaPC(id, idCli, idPC, descrição, veredicto) ParteContraria(id, nomePC, telefonePC, cpfPC) Advogado(id, oab, nomeAdv, telefoneAdv) CliPossuiAdv(id, idCli, idAdv) 25) 26) CREATE TABLE Advogado ( idAdv int PRIMARY KEY NOT NULL, oab int, nomeAdv CHAR(25), telefoneAdv CHAR(10) ); ALTER TABLE Advogado ADD CONSTRAINT PK_Advogado PRIMARY KEY (idAdv); CREATE TABLE Cliente ( idCli int PRIMARY KEY NOT NULL, nomeCli CHAR(25), enderecoCli CHAR(30), telefoneCli CHAR(10), cpfCli CHAR(9), cnpjCli INT, tipoProcCli CHAR(50)
  • 15. ); ALTER TABLE Cliente ADD CONSTRAINT PK_Cliente PRIMARY KEY (idCli); CREATE TABLE ParteContraria ( idPC int PRIMARY KEY NOT NULL, nomePC CHAR(25), telefonePC CHAR(10), cpfPC CHAR(9) ); ALTER TABLE ParteContraria ADD CONSTRAINT PK_ParteContraria PRIMARY KEY (idPC); CREATE TABLE CliPossuiAdv ( idCliAdv int PRIMARY KEY NOT NULL, idPC int NOT NULL, idAdv int NOT NULL, idCli int NOT NULL ); ALTER TABLE CliPossuiAdv ADD CONSTRAINT PK_CliPossuiAdv PRIMARY KEY (idCliAdv,idPC,idAdv ,idCli); CREATE TABLE CliProcessaPC ( idCliPC int PRIMARY KEY NOT NULL, idCli int NOT NULL, idPC int NOT NULL, descricao CHAR(10), veredicto CHAR(10) ); ALTER TABLE CliProcessaPC ADD CONSTRAINT PK_CliProcessaPC PRIMARY KEY (idCliPC,idCli ,idPC); ALTER TABLE CliPossuiAdv ADD CONSTRAINT FK_CliPossuiAdv_0 FOREIGN KEY (idPC) REFERENCES ParteContraria (idPC); ALTER TABLE CliPossuiAdv ADD CONSTRAINT FK_CliPossuiAdv_1 FOREIGN KEY (idAdv ) REFERENCES Advogado (idAdv); ALTER TABLE CliPossuiAdv ADD CONSTRAINT FK_CliPossuiAdv_2 FOREIGN KEY (idCli ) REFERENCES Cliente (idCli); ALTER TABLE CliProcessaPC ADD CONSTRAINT FK_CliProcessaPC_0 FOREIGN KEY (idCli ) REFERENCES Cliente (idCli); ALTER TABLE CliProcessaPC ADD CONSTRAINT FK_CliProcessaPC_1 FOREIGN KEY (idPC ) REFERENCES ParteContraria (idPC);
  • 16. 27)
  • 18. 30) 31) package java.Envolvido; public class Advogado { private Cliente cliente; private Advogado advogado; private Advogado advogado; } public class AdvogadoDAO implements IAdvogadoDAO { } public class private private private } Cliente { IAdvogadoDAO iAdvogadoDAO; Advogado advogado; IParteContrariaDAO iParteContrariaDAO; public class ClienteDAO implements IClienteDAO { } public interface IAdvogadoDAO { private Cliente cliente; } public interface IClienteDAO { private ParteContraria parteContraria; } public interface IParteContrariaDAO { private Cliente cliente; } public class ParteContraria {
  • 19. private IClienteDAO iClienteDAO; } public class ParteContrariaDAO implements IParteContrariaDAO { } 32) a) b) Unidade(idUni, região, endereço) Venda(idVend, valor, idUni) Produto(idProd, preco) VendProd(id, idProd, idVend) Porca(idProd, preco, diametro) Parafuso(idProd, preco, tamanho) Pino(idProd, preco, tamanho) Arruela(idProd, preco, diametro) c) CREATE TABLE Venda ( valor DOUBLE ); CREATE TABLE Produto ( preco VARCHAR(10) ); CREATE TABLE Unidade ( regiao VARCHAR(10),
  • 20. endereco VARCHAR(10) ); CREATE TABLE Arruela ( diametro INT ); CREATE TABLE Parafuso ( tamanho INT ); CREATE TABLE Pino ( tamanho INT ); CREATE TABLE Porca ( diametro INT ); 33) a) b)
  • 21. c) NomeCientifico(idNomeCientifico, idGenero, nomeCientifico) SerVivo(id, idNomeCientifico, nomePopular, idGenero, idFamilia, idClasse, idReino, idFilo) CategoriaTaxonomica(idSerVivo) Genero(idGenero, nomeGenero) Familia(idFamilia, nomeFamilia) Classe(idClasse, nomeClasse) Reino(idReino, nomeReino) Filo(idFilo, nomeFilo) d) A vantagem da Gen/Espec é que ela torna mais fácil a compreensão de suas filhas, deixando claro que nome científico, gênero, família, classe, reino e filo são tipos de categorias taxonômicas. O problema é que essa relação
  • 22. poderia ser mais resumida, criando um atributo “tipo” na classe categoria taxonômica, que receberia os valores de suas filhas. Por exemplo: e) CREATE TABLE Classe ( idClasse int PRIMARY KEY NOT NULL, nomeClasse CHAR(20) ); ALTER TABLE Classe ADD CONSTRAINT PK_Classe PRIMARY KEY (idClasse); CREATE TABLE Familia ( idFamilia int PRIMARY KEY NOT NULL, nomeFamilia CHAR(20) ); ALTER TABLE Familia ADD CONSTRAINT PK_Familia PRIMARY KEY (idFamilia); CREATE TABLE Filo ( idFilo int PRIMARY KEY NOT NULL, nomeFilo CHAR(20) ); ALTER TABLE Filo ADD CONSTRAINT PK_Filo PRIMARY KEY (idFilo); CREATE TABLE Genero ( idGenero int PRIMARY KEY NOT NULL, nomeGenero CHAR(20) );
  • 23. ALTER TABLE Genero ADD CONSTRAINT PK_Genero PRIMARY KEY (idGenero); CREATE TABLE Reino ( idReino int PRIMARY KEY NOT NULL, nomeReino CHAR(20) ); ALTER TABLE Reino ADD CONSTRAINT PK_Reino PRIMARY KEY (idReino); CREATE TABLE CategoriaTaxonomica ( idSerVivo int PRIMARY KEY NOT NULL, idGenero int ); ALTER TABLE CategoriaTaxonomica ADD CONSTRAINT PK_CategoriaTaxonomica PRIMARY KEY (idSerVivo); CREATE TABLE SerVivo ( idSerVivo int PRIMARY KEY NOT NULL, idNomeCientifico VARCHAR(25) NOT NULL, idGenero int NOT NULL, idFamilia int NOT NULL, idClasse int NOT NULL, idReino int NOT NULL, idFilo int NOT NULL, nomePopular CHAR(30) ); ALTER TABLE SerVivo ADD CONSTRAINT PK_SerVivo PRIMARY KEY (idSerVivo,idNomeCientifico,idGenero,idFamilia,idClasse,idReino,idFilo); CREATE TABLE NomeCientifico ( idNomeCientifico int PRIMARY KEY NOT NULL, nomeCientifico CHAR(30) ); ALTER TABLE NomeCientifico ADD CONSTRAINT PK_NomeCientifico PRIMARY KEY (idNomeCientifico); ALTER TABLE CategoriaTaxonomica ADD CONSTRAINT FK_CategoriaTaxonomica_0 FOREIGN KEY (idGenero) REFERENCES Genero (idGenero); f) /* criando as tabelas */ create table NomeCientifico( idNomeCientifico int primary key auto_increment not null,
  • 24. idGenero int, constraint fk_idGenero foreign key (idGenero) references Genero (idGenero), nomeCientifico varchar(30)) create table SerVivo( idSerVivo int primary key auto_increment not null, nomePopular varchar(30), idNomeCientifico int, idGenero int, idFamilia int, idClasse int, idReino int, idFilo int, constraint fk_idNomeCientifico foreign key (idNomeCientifico) references NomeCientifico (idNomeCientifico), constraint fk_idGenero foreign key (idGenero) references Genero (idGenero), constraint fk_idFamilia foreign key (idFamilia) references Familia (idFamilia), constraint fk_idClasse foreign key (idClasse) references Classe (idClasse), constraint fk_idReino foreign key (idReino) references Reino (idReino), constraint fk_idFilo foreign key (idFilo) references Filo (idFilo)) create table CategoriaTaxonomica( idSerVivo int, constraint fk_idSerVivo foreign key (idSerVivo) references SerVivo (idSerVivo)) create table Genero( idGenero int primary key auto_increment not null, nomeGenero varchar(30)) create table Familia( idFamilia int primary key auto_increment not null, nomeFamilia varchar(30)) create table Classe( idClasse int primary key auto_increment not null, nomeClasse varchar(30)) create table Reino( idReino int primary key auto_increment not null, nomeReino varchar(30)) create table Filo( idFilo int primary key auto_increment not null, nomeFilo varchar(30)) /* populando as tabelas com os dados de cachorro */ insert into SerVivo values(01, ‘cachorro’, 01, 01, 01, 01, 01, 01) insert into NomeCientifico values (01, 01, ‘canis lupus familiaris’) insert into CategoriaTaxonomica values (01) insert into Genero values (01, ‘canis’) insert into Familia values 01, ‘canidae’) insert into Classe values (01, ‘mammalia’) insert into Reino values (01, ‘animalia’)
  • 25. insert into Filo values (01, ‘chordata’) /* populando as tabelas com os dados de humano */ insert into SerVivo values(02, ‘humano’, 02, 02, 02, 02, 02, 02) insert into NomeCientifico values (02, 02, ‘homo sapiens’) insert into CategoriaTaxonomica values (02) insert into Genero values (02, ‘homo’) insert into Familia values 02, ‘hominidae’) insert into Classe values (02, ‘mammalia’) insert into Reino values (02, ‘animalia’) insert into Filo values (02, ‘chordata’) g) /* pesquisando dados do cachorro */ SELECT SerVivo.nomePopular, NomeCientifico.nomeCientifico, Genero.nomeGenero, Familia.nomeFamilia, Classe.nomeClasse, Reino.nomeReino, Filo.nomeFilo FROM SerVivo INNER JOIN NomeCientifico ON SerVivo.idNomeCientifico = NomeCientifico.idNomeCientifico INNER JOIN Genero ON SerVivo.idGenero = Genero.idGenero INNER JOIN Familia ON SerVivo.idFamilia = Familia.idFamilia INNER JOIN Classe ON SerVivo.idClasse = Classe.idClasse INNER JOIN Reino ON SerVivo.idReino = Reino.idReino INNER JOIN Filo ON SerVivo.idFilo = Filo.idFilo WHERE idSerVivo = 1; /* pesquisando dados do humano */ SELECT SerVivo.nomePopular, NomeCientifico.nomeCientifico, Genero.nomeGenero, Familia.nomeFamilia, Classe.nomeClasse, Reino.nomeReino, Filo.nomeFilo FROM SerVivo INNER JOIN NomeCientifico ON SerVivo.idNomeCientifico = NomeCientifico.idNomeCientifico INNER JOIN Genero ON SerVivo.idGenero = Genero.idGenero
  • 26. INNER JOIN Familia ON SerVivo.idFamilia = Familia.idFamilia INNER JOIN Classe ON SerVivo.idClasse = Classe.idClasse INNER JOIN Reino ON SerVivo.idReino = Reino.idReino INNER JOIN Filo ON SerVivo.idFilo = Filo.idFilo WHERE idSerVivo = 2;