Giter Site home page Giter Site logo

lab-quiz-1's Introduction

Classes and ArrayLists

This is a for COMP 167 Computer Program Design at North Carolina A&T State University.

Instructor: Professor Karen Schnell - [email protected]

Lab Description

You will be creating a contacts application to store information about clients for a business. I will give you a GUI project that I developed and you will to provide the backend functionality for the GUI project by developing two classes: Client and ContactList. The data for your application will come from a comma delimited file containing information about the clients. Ideally, you would use the validation methods to filter out contacts with issues. You are free to use the validation methods developed in the String Processing lab; however, it is not a requirement. You can just load all the records from the file this week. Note: You will have to modify the input method from the String Processing lab since I changed the input file format slightly by adding the name of the contact list as the first line of input (See the Input File Format section below).

Figure01

Step 1:

Create a new project and name it ContactsModel. Next, create the Client class in this project under the contactsmodel package. Once you have finished adding the code for Client, test it out adding code to your main method that declares and instantiates a Client object. Use the setter methods to modify some properties. Output the contents of the client object using the toString() and System.println() methods. Make sure the toString() method returns a string with values seperated by a comma.

Client Class

This class will model a single client. Figure02

Step 2:

Within the same project and package, create the ContactList class (notice that “Contact” is not plural). At this point, you will want to set the Working Directory to where you saved your contacts.txt input file. For this lab, you may assume that the input file will always be named “contacts.txt”. Implement the methods for the ContactList class according to the UML Class Diagram below. To test the loadContacts() method, call and return value from the toString() method of the ContactList class. It should display each client in a nicely formatted table. You should then add some new contacts to your ContactsList object by instantiating new Client objects, populating them with data and then calling the addContact method. After adding some contacts, call the saveContacts() method and exit your program. When you restart your program using your modified input file, the added contacts should be loaded.

ContactList Class

This class will contain an ArrayList and will model the entire contact list for an individual or the entire company. Figure03

Input File Format:

list name

firstname0, lastname0, gender0, age0, phone0, email0 firstname1, lastname1, gender1, age1, phone1, email1

Step 3:

Integrate your code with my GUI. If you do not implement things as outlined in the UML class diagrams, then your code will probably not work with my GUI code. Just FYI, the GUI project was created using the JavaFX SceneBuilder tool so there will be a lot of stuff in there that will look foreign. You do not have to worry about understanding my code since you will not be modifying any of it. You simply need to make your classes available for the GUI. Here’s how. Right click the “Libraries” folder in the GUI project (ContactsApp) and then select “Add jar/folder”. Navigate to the “dist” folder of your ContactsModel folder and select contactsmodel.jar. You should now be able to run the application. Make sure you set the ContactsApp project as your main project. Note: I did not get a chance to implement the Add functionality on the GUI so clicking the button will not initiate any action.

lab-quiz-1's People

Contributors

ccannon94 avatar waltbo avatar nzingaholloman avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.