A company purchase parts from vendors that are used by employees to assemble mac
ID: 3599874 • Letter: A
Question
A company purchase parts from vendors that are used by employees to assemble machines. Customers purchase the assembled machines. Customers purchase many different machines. Each employee only works on the assembly of one machine. However, many employees work on assembling the same machine. Some of the same parts are used by the different machines; these parts are identified by color v = vendor m = machine c = customer p = parts e = employee Given attributes: va, vname, vstate, price, p#, pname, pcolor, m#. mname, mweight, e#, ename, qty, c# cname, cadd Given dependencies: determines v vname, vstate determines c#, cname, cadd c, m# determines c#, m#, qty va, p# determines v#, p#, price e# determines e4, ename, m#, mname, mweight m# determines m#, mname, mweight p# determines p#, pname m#, p# determines, m#, p#, pcolor Given the above information perform the following, make certain to use the appropriate conventions and underline key attributes (points will be taken off. Make certain you identify EACH section or you will lose points if I cannot identify the step. Submit all of your answers including the diagrams in ONE Word or .pdf document. Section 4: Draw an E/R Diagram showing all cardinality (10 points for the ER diagram and 5 points for Cardinality). You do NOT have to do the degree of cardinality. Your final diagram should have 1:m relationships ONLY Section 5: Draw a Relational Schema (10 points)
Explanation / Answer
package edu.gregory.gelfond.clients;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
public class EchoClient {
private static final int EXIT_FAILURE = 1;
public static void main(String[] args) throws IOException {
if (args.length != 2) {
System.err.printf("usage: java EchoClient <host name> <port number> ");
System.exit(EXIT_FAILURE);
}
String hostName = args[0];
int port = Integer.parseInt(args[1]);
try (
Socket echoSocket = new Socket(hostName, port);
PrintWriter socketOutput = new PrintWriter(echoSocket.getOutputStream(), true);
BufferedReader socketInput = new BufferedReader(new InputStreamReader(echoSocket.getInputStream()));
BufferedReader console = new BufferedReader(new InputStreamReader(System.in))) {
String userInput;
while ((userInput = console.readLine()) != null) {
socketOutput.println(userInput);
System.out.println("echo: " + socketInput.readLine());
}
}
catch (UnknownHostException error) {
System.err.printf("unknown host: %s ", hostName);
System.exit(EXIT_FAILURE);
} catch (IOException error) {
System.err.printf("unable to establish I/O connection to %s ", hostName);
System.exit(EXIT_FAILURE);
}
}
Echo Server:-
package edu.gregory.gelfond.servers;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class EchoServer {
private static final int EXIT_FAILURE = 1;
public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.err.printf("usage: java EchoServer <port number> ");
System.exit(EXIT_FAILURE);
}
int portNumber = Integer.parseInt(args[0]);
try (
ServerSocket serverSocket = new ServerSocket(Integer.parseInt(args[0]));
Socket clientSocket = serverSocket.accept();
PrintWriter clientOutput = new PrintWriter(clientSocket.getOutputStream(), true);
BufferedReader clientInput = new BufferedReader( new InputStreamReader(clientSocket.getInputStream()))) {
String inputLine;
while ((inputLine = clientInput.readLine()) != null)
{ clientOutput.println(inputLine);
}
}
catch (IOException error)
{
System.out.printf("error when trying to listen on port %d or listening for connection ",portNumber);
System.out.println(error.getMessage());
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.