Question

In: Computer Science

Part four: using JDBC with mysql for project management program. I cannot copy the whole code,...

Part four: using JDBC with mysql for project management program. I cannot copy the whole code, so will split it into a few parts.

See part one and two and three.

Part four of The code is (starts at line 499, rest of code):

}
}
catch (Exception e)
{
e.printStackTrace();
}
if (foundSomething)
{
// pass
}
else
{
System.out.print("Search result is empty!\n");
}
goBacktoMenu(); // go back to main menu
}
static void finalizeMenu(ArrayList<ProjectDetails> projectList)
{
System.out.print("========================Finalize project==========================\n\n");
System.out.print("Note that there are currently " + projectNum + " project(s) registered.\n"
+ "Project numbers start from 1\n");
if (projectNum == 0)
{ // there are 0 projects do not allow user to continue
return;
}
System.out.print("\nEnter the project number you want to finalize: ");
int index = 0;
try
{
String i = userInput.nextLine();
index = Integer.parseInt(i); // convert user input to integer
}
catch (Exception e)
{
System.out.print("**wrong input format!**");
return;
}
index = index - 1; // subscript start at 0
if (index >= 0 && index < projectNum && projectList.isEmpty() == false && projectList.get(index) != null)
{
System.out.print("\n\n"); // newlines
projectList.get(index).finalizeProject(projectList.get(index));
}
else
{
System.out.print("Make sure you enter a valid project number!\n");
}
}
static void getExistingProjects(ArrayList<ProjectDetails> projectList) throws FileNotFoundException
{
ArrayList<String> list = new ArrayList<String>(); // list will store projects from txt file
ProjectDetails proj = new ProjectDetails(); // create project object that will be stored in projectList
   proj.setProjectName(list.get(0));
   boolean finalized = Boolean.parseBoolean(list.get(1));
   proj.setIsFinalized(finalized);
   proj.setBuildingType(list.get(2));
   proj.setPhysicalAddress(list.get(3));
   proj.setErfNum(list.get(4));
   proj.setTotalFee(Double.parseDouble(list.get(5)));
   proj.setTotalPaidtoDate(Double.parseDouble(list.get(6)));
   LocalDate dateObj = null;
   DateTimeFormatter myFormatObj = null;
   myFormatObj = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // format how date object will be
   dateObj = LocalDate.parse(list.get(7), myFormatObj);
   proj.setDate(dateObj); // project date assigned
   dateObj = LocalDate.parse(list.get(8), myFormatObj);
   proj.setProjectDeadline(dateObj); // project deadline
   ProjectDetails.setCustomer(list.get(9), list.get(10), list.get(11), list.get(12), "customer");
   ProjectDetails.setArchitect(list.get(13), list.get(14), list.get(15), list.get(16), "architect");
   ProjectDetails.setContractor(list.get(17), list.get(18), list.get(19), list.get(20), "contractor");
   projectList.add(proj); // add project to the list of projects
   proj.setProjectNum(++projectNum); // increment number of projects
   list.clear(); // list is cleared for next new project
     
   for(ProjectDetails obj: projectList)
   {
   displayExistingProjects(obj); // display projects to the user
   }
goBacktoMenu(); // Function to go back to main menu.
}
// Method to go back to main menu.
static void goBacktoMenu()
{
System.out.print("\n*** Press enter to go back to main menu ***\n");
try
{
System.in.read();
}
catch (Exception e)
{
}
}
public static void displayExistingProjects(ProjectDetails proj)
{
String content = " "; // this variable will store all information pertaining to the project
content = "**************Project number: " + proj.getProjectNum() + " ************************\n\n";
content += "Is project finalized ?: " + proj.isFinalized() + "\n";
content += "Project name: " + proj.getProjectName() + "\n";
content += "Type of building: " + proj.getBuildingType() + "\n";
content += "The physical address for the project: " + proj.getPhysicalAddress() + "\n";
content += "ERF number: " + proj.getErfNum() + "\n";
content += "The total fee charged for the project: " + proj.getTotalFee() + "\n";
content += "The total amount paid to date: " + proj.getTotalPaidtoDate() + "\n";
DateTimeFormatter myFormatObj;
myFormatObj = DateTimeFormatter.ofPattern("dd MMMM yyyy");
String formattedDate = proj.getDate().format(myFormatObj);
content += "Project date assigned: " + formattedDate + "\n";
formattedDate = proj.getProjectDeadline().format(myFormatObj);
content += "Project deadline: " + formattedDate + "\n";
content += "\n";
content += "Customer\'s details:\n";
content += "Name: " + proj.getCustomer().getName() + "\n";
content += "Email: " + proj.getCustomer().getEmail() + "\n";
content += "Telephone: " + proj.getCustomer().getTelNum() + "\n";
content += "address: " + proj.getCustomer().getPhysicalAddress() + "\n";
content += "\n";
content += "Architect\'s details:\n";
content += "Name: " + proj.getArchitect().getName() + "\n";
content += "Email: " + proj.getArchitect().getEmail() + "\n";
content += "Telephone: " + proj.getArchitect().getTelNum() + "\n";
content += "address: " + proj.getArchitect().getPhysicalAddress() + "\n";
content += "\n";
content += "Contractor\'s details:\n";
content += "Name: " + proj.getContractor().getName() + "\n";
content += "Email: " + proj.getContractor().getEmail() + "\n";
content += "Telephone: " + proj.getContractor().getTelNum() + "\n";
content += "address: " + proj.getContractor().getPhysicalAddress() + "\n\n";
System.out.print(content); // display projects
}
}

Solutions

Expert Solution

VHDL: Creating a Hierarchical Design

This example describes how to create a hierarchical design using VHDL. The top-level design, called top.vhd, implements an instance of the function logic.vhd. In the top.vhd file, a component for the logic function is declared inside the architecture in which it is instantiated. The Component Declaration defines the ports of the lower-level function.

Related Links

For more information on using this example in your project, refer to the How to Use VHDL Examples section on the VHDL web page.

top.vhd (Top-level file)

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

ENTITY top IS
      PORT(w_in, x_in, y_in :IN std_logic;
               clock        :IN std_logic;
               z_out        :OUT std_logic);
END top;

ARCHITECTURE a OF top IS

COMPONENT logic
        PORT(a,b,c    :IN std_logic;
              x       :OUT std_logic);
END COMPONENT;

SIGNAL w_reg, x_reg, y_reg, z_reg   :std_logic;

BEGIN
low_logic       : logic PORT MAP (a => w_reg, b => x_reg, c => y_reg, x => z_reg);

PROCESS(clock)
BEGIN
     IF (clock'event AND clock='1') THEN
         w_reg<=w_in; x_reg<=x_in; y_reg<=y_in; z_out<=z_reg; END IF; END PROCESS; END a; </PRE>

logic.vhd

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

ENTITY logic IS
      PORT(a,b,c     : IN std_logic;
             x       : OUT std_logic);
END logic;

ARCHITECTURE a OF logic IS
BEGIN
PROCESS (a,b,c)
BEGIN
     x<=(a and b) or c; END PROCESS; END; </pre>

Related Solutions

I have to code the assignment below. I cannot get the program to work and I...
I have to code the assignment below. I cannot get the program to work and I am not sure what i am missing to get the code to work past the input of the two numbers from the user. My code is listed under the assignment details. Please help! Write a Java program that displays the prime numbers between A and B. Inputs: Prompt the user for the values A and B, which should be integers with B greater than...
This is in MySQL Part one: Using the MySQL Workbench Data Modeler, construct a diagram that...
This is in MySQL Part one: Using the MySQL Workbench Data Modeler, construct a diagram that shows the table in 3rd Normal Form. Part two: Provide a summary of the steps you took to achieve 3rd Normal form. Include your rationale for new table creation, key selection and grouping of attributes. Table Details: The Anita Wooten Art Gallery wishes to maintain data on their customers, artists and paintings. They may have several paintings by each artist in the gallery at...
For Project Management... in a project, you setup a whole procedure for risk management. If the...
For Project Management... in a project, you setup a whole procedure for risk management. If the risk does occur in the project what do you do? Please be detailed (you setup your risk control obviously, please add more insight).
Project Management: If I cannot resolve over allocation by leveling within slack, what can I consider...
Project Management: If I cannot resolve over allocation by leveling within slack, what can I consider to do?
Describe the business value created by using the disciplines of project management and program management. How...
Describe the business value created by using the disciplines of project management and program management. How can project and program management increase profits and/or decrease costs?
This is part of the whole assignment. It is sorta long. But them short. And I...
This is part of the whole assignment. It is sorta long. But them short. And I would appreciate it if somebody helped me! Thank you. It is part of personal finance. Q1: Describe two examples of important things that financial planning skills can help you do, and explain why these things are important to you personally. (4-6 sentences) Q2: List two examples of goods you have purchased in the past or may purchase in the future. (Complete sentences are not...
We are to make a program about a car dealership using arrays. I got the code...
We are to make a program about a car dealership using arrays. I got the code to display all cars in a list, so I'm good with that. What I'm stuck at is how to make it so when a user inputs x for search, it allows them to search the vehicle. We need two classes, one that shows the car information and another that shows the insert, search, delete, display methods. Here is what I have so far package...
I have done the first part of this problem, but I cannot figure out the second...
I have done the first part of this problem, but I cannot figure out the second part. I know there are several different answers already posted on Chegg for this particular problem with different acceleration and time, but I need this one specifically, with a step by step solution. Again...just PART B....the answer to Part A is 201.72 A helicopter carrying Dr. Evil takes off with a constant upward acceleration of 4.20 m/s2. Secret agent Austin Powers jumps on just...
Using PHP and MYSQL and with a simple customer database, how can I create a simple...
Using PHP and MYSQL and with a simple customer database, how can I create a simple log in and registration system for an ecommerce site
Question p10-32a version 10. For some reason I can't copy and paste the whole question. In...
Question p10-32a version 10. For some reason I can't copy and paste the whole question. In looking at the explanation in Chegg there were 29 steps. I am sure that isn't all just the journal entries needed?? Gretta Chung Associates survey American eating habits. The companies accounts include land, building, office equipment, and communication equipment with separate accumulated depreciation account for each asset. During 2014 Chung Completed the following transactions: Jan. 1 Purchased office equipment, $119,000. Paid $80,000 cash and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT