Java代写 | CS 260, Fall 2019, Paul Wagner

本次Java代写是编写一个Java / JDBC / Oracle应用程序,该应用程序支持在Oracle数据库中插入

CS 260, Fall 2019, Paul Wagner

Assignment #3 (Individual or Pairs (two students)), 100 points Due Friday November 22nd, 9:00 AM

Humanitarian Resource Data through Java/JDBC

Individuals or Pairs

You can work on this assignment either as an individual or as a pair (two students only).

  • If you choose to work as an individual, please notify me by email at [email protected] no later than Friday, November 8th at 5:00 PM of this choice.
  • If you choose to work as a pair of your own selection, one of the pair should email me at [email protected] no later than Friday, November 8th at 5:00 PM, with both names in the body of the email.
  • If you want to work as a pair, but don’t have a partner, please email me at [email protected] with this information no later than Friday November 8th at 5:00 PM, and I will try to help you find a partner by assigning pairs based on such requests, on a first-requested first-assigned basis as requests come in. For example, the first request will be paired with the second request, the third request will be paired with the fourth request, etc. Do not wait until the last minute to make such a request, as it is possible based on other student choices that there may not be enough requests to fulfill the final pair request. I will notify any student for whom I cannot find a partner no later than Saturday November 9th at 5:00 PM, and I will take this into account in grading.
  • If you do not contact me by Friday November 8th at 5:00 PM, you will be working on the assignment as an individual. No late requests for pairing will be accepted.

General Information

Online maps such as Google Maps are marked to indicate points of interest, such as restaurants, hotels and motels, local businesses, and other interesting locations such as parks and local landmarks. In events of disaster or other emergencies, such markers may be very important in helping the local population and any aid workers locate resources. We’ll develop a system to support a limited database of resources for the Eau Claire community which could, in the future, be used to display local resource maps.

Overall Assignment

Your overall task is to write a Java / JDBC / Oracle application that provides support for inserting, updating and deleting resource information into an Oracle database.

Interface – Text-Based or GUI

The insert, update and delete functionality can be done through a console / text-based interface, though a GUI interface is certainly allowable for those students familiar with Java GUI construction. Your application should support data entry for any of the three resource types: medical center, water, or food. It should also support each of the three “write” operations for each resource type; that is, inserting a given resource, updating a resource, and deleting a resource.

Limitations on Operations Required

For this assignment, it’s only required that you implement one update operation for each type of resource (Medical Center, Water, or Food) – you should pick a particular row instance by HRID, display each current field value in order, for every field except the HRID (primary key values shouldn’t change) and the HRType (too complicated for this assignment to allow the entire class type to change), allow the user to change each field in turn, and then to update that instance by updating all fields with changed values.

For delete, you only have to allow delete of a single instance at a time, based on the HRID. You do NOT have to support delete for arbitrary WHERE conditions (e.g. all Medical Centers, or all resources with an HRID greater than 100).

Input From User

You will have to get enough information from the user to decide which of the three resource types is currently being worked with, which operation (insert, update or delete) is required, which resource instance will be affected (in the case of update or delete, by HRID), and what new data values will be used (in the case of insert and update). A simple console-based read method was shown in the file from Canvas (mentioned in the lecture notes and discussed in lecture). This functionality can be used to read in a data value for a given field from the keyboard. You are welcome to construct your data reading method or methods as well.

Generating SQL Strings

Remember that the SQL strings you execute do not have to be hard coded strings (e.g. SELECT * FROM Account, or the INSERT statements you generated in lab 7). As we discussed in lecture, you can build your own SQL strings using either the string concatenation operator (+) or other classes such as StringBuilder, combining SQL phrases (for example “INSERT INTO Account VALUES (“ as the first part of an SQL insert statement) with variable values that you get from input. Be sure that strings that you send to Oracle are executable, for example that any string literals are enclosed in single quote marks. It’s worth manually checking the strings you build for correctness. Remember that SQL strings executed through JDBC must NOT have an ending semicolon.

All Work Done As Transactions

Each of your operations should be done as a transaction, regardless of whether they affect one row or multiple rows. Each operation should modify data consistently in both the general Resource table and in the appropriate child table (MedicalCenter, Water, or Food) as well.

Data Access Object

You are welcome to use the DataAccessObject class from lab 8 to isolate your JDBC and database activity, or you can construct your own DataAccessObject class. Either way, all JDBC and database operations must be isolated in this class.

Overall Program Structure/Organization

Overall, your program should be well-organized and modular. Try to use the concepts of high cohesion and low coupling

  • each class should provide the data and methods for one concept, and classes should not be overly tied to other classes, with the primary exceptions being as parameters in method calls and declaration of a class instance as a local variable for usage in another class.

    Code Style and Formatting

    Your program should also follow the principle of good style and formatting. In this class, that includes, but is not limited to:

    • comments briefly describing each class
    • comments for each declared variable describing its purpose
    • comments above each method describing what the method does
    • comments for major sections of a method
    • good use of white space – at a minimum, use blank lines between methods, and white spaces on both sides of all operators to make your code more readable

Database Structure

We will use four database tables to store resource information, as follows:

HumResource (HRID, HRName, HRAddressString, HRPhoneNumber, HRLatitude, HRLongitude, HRType, HRDesc, HROpenHoursString)

MedicalCenter (HRID (FK), NumBeds, EmergencyRoomCapacity, NumDoctors, NumNurses)

Water (HRID (FK), Num10OzBottlesAvailable, NumHalfLiterbottlesAvailable, Num5GallonJugsAvailable) Food (HRID (FK), FType, FMealsAvailable, FSpecificDesc)

Database Field Definitions

HRID – overall humanitarian resource id number

HRName – the name of the resource (e.g. Mayo/Luther Hospital) HRAddressString – the street address as a string, for display only

HRPhoneNumber – the phone number for the resource, in format DDD.DDD.DDDD (D = digit 0-9) HRLatitude – the resource geographical location latitude (e.g. 48.4427475)

HRLongitude – the resource geographical location longitude (e.g. 22.9175259) HRType – one of ‘MedicalCenter’, ‘Water’ or ‘Food’

HRDesc – a short description of the resource, including features that may be useful to people HROpenHoursString – a list of open hours of the resource, as a string, for display only NumBeds – the number of beds available in that medical center

EmergencyRoomCapacity – the number of emergency patients that can be treated simultaneously NumDoctors – the number of doctors generally available in that medical center

NumNurses – the number of nurses generally available in that medical center

<Water fields – self-explanatory>

FType – the type of food resource; may have one value from ‘Grocery’, ‘Distributor’, ‘Restaurant’ FMealsAvailable – an estimate of how many meals the resource currently has available for consumption FSpecificDescription – a further description of the individual food resource

Database Field Data Types

A script file with sample data is provided on Canvas.

Program Design / Class Organization

The question arises as to how many classes are needed in Java to represent the data for the four tables that you’ll be working with. Here are some possibilities for your program.

  1. Four Java classes with separate data for each class (the parent HumResource class, plus each of the three sub-classes of Medical Center, Food and Water).
  2. Three Java classes for the sub-classes (Medical Center, Food, and Water), but have the three classes each include the common data from HumResource as well as their specific data.
  3. For those who have worked with inheritance in Java, make HumResource a parent class, and have each of the three regular resource classes extend your HumResource parent class. The three child classes only declare the additional specific data that they add. This will still give you all needed data in the three regular classes, as the common fields will be inherited into those three classes.


    You can also test your insert, update and delete functionality through queries in SQL Developer.


    1. Generate JAR (in Eclipse) or ZIP (in IntelliJ IDEA) files for your application or applications, making sure that your source code for Java file that is part of your application is included.
      1. In Eclipse, Export your project to create a JAR file (right-click on your project, choose Export, choose Java JAR file, making sure that you select the option that source code files and resources are added. Points will be deducted if I must ask you for a resubmission because source files were not added.
      2. In IntelliJ IDEA, Export your project as a ZIP file (File/Export to ZIP file). This should create a folder of all of your project files, including all source code.
    2. By the deadline of Friday, November 22nd at 9:00 AM, submit your JAR or ZIP file or files to Canvas.

    3. I will ask you to run your application for testing during lab on Friday, November 22nd.
    4. I will also examine your source code (later, after you have demonstrated your application.)
    5. If you are working as a pair, only one submission need be made by one of the two team members. As long as you have notified me by the pair selection deadline, I will give an equal score to both pair team members.


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:itcsdx