Giter VIP home page Giter VIP logo

Md. Rakibul Islam's Projects

100-days-of-code icon 100-days-of-code

Fork this template for the 100 days journal - to keep yourself accountable (multiple languages available)

1410-assignment-7 icon 1410-assignment-7

Geocaches For the purposes of this assignment you do not need to know what geocaches are, but it can't hurt. Geocaches are containers of various sizes that are hidden throughout the world. Geocachers (such as me) are people who enjoy looking for geocaches. There is a free geocaching app available for smart phones. There is also a website, https://www.geocaching.com/play/search, (Links to an external site.)Links to an external site. that we use to learn about geocaches in our area. For example, there are more than 200 geocaches within two miles of MEB. Every geocache at geocaching.com has (among other things) a title, an owner, the GPS coordinates where it is located, a difficulty rating that describes how difficult the geocache is to find, and a terrain rating that describes how hard it is to travel to the hiding place. My geocaching name is "lesdubois", and I specialize in hiding "puzzle" caches. To get the GPS coordinates of a puzzle cache, you have to first solve a puzzle. To solve one of my puzzles, Digital Dilemma 2 (Links to an external site.)Links to an external site., the geocacher needs to write some simple computer programs. If you're interested, the programs required are the right difficulty for CS 1410 students. But I digress. Getting Started You will be completing the implementation of a program that I have started. Your job will be to provide correct implementations and unit tests for two classes: Cache and CacheList. Begin by running PS7Demo.jar. Use the file chooser that pops up to navigate to and open the file caches.txt, which contains a list of geocaches. (The list is a few years old, so some of the geocaches it contains no longer exist.) The program will then open an application that lets you search through the contents of caches.txt. When you have completed this assignment, your program should behave just like the demo program you have just run. The four source files define five classes: Cache, CacheList, GeocacheBrowser, CacheTests, and CacheListTests. You should not modify GeocacheBrowser. Unless you are curious, you do not need to understand it or even look at it. GeocacheBrowser contains a main method. Run it, and it will bring up the same application as the jar file. Most everything will be blank, however, until you complete Cache and CacheList. The application uses Cache objects (implemented by your Cache class) to represent individual geocaches. It uses a CacheList object (implemented by your CacheList class) to keep track of, filter, and sort all the Cache objects. Please read and follow the directions carefully. Cache Class The Cache class provides objects that represent information about a single geocache. The class file contains complete specifications as well as a completed implementation for the toString method. You should Read carefully through the entire class file. Create a complete set of unit tests for the Cache class. I have created a test class called CacheTests that contains a sample test. You should add your tests to this class. The TAs and I will not help you with your Cache class implementation until you have completed this step! The key to testing class implementations is to realize that it is not usually possible to test each constructor and method in isolation. For example, to test the getOwner() method of the Cache class, you must first use the constructor to create a Cache object. Design a representation and then declare and document your instance variables. Implement the constructor. Each line of the file caches.txt is an example of a string that the constructor should be able to take as a parameter. (Hint: Use the String split method.) Implement the methods (other than toString, which is already complete). Test/debug/modify your Cache and CacheTests classes until you are certain that the Cache class behaves according to its specifications. CacheList Class The CacheList class provides objects that represent collections of Caches as well as constraints on them. The class file contains complete specifications as well as a partial implementation. You should Read carefully through the entire class file. Create a complete set of unit tests for for the CacheList class. I have created a test class called CacheListTests that contains a sample test. You should add your tests to this class. The TAs and I will not help you with your CacheList class implementation until you have completed this step! Keep in mind that it is not usually possible to test each constructor and method in isolation. For example, to test the setTitleConstraint() method of the CacheList class, you must use the constructor to create a CacheList object, use setTitleConstraint(), and then call the select() method to see if the title constraint has the proper effect. Design a representation and then declare and document your instance variables. Please note that I have already provided a key part of the representation. Complete the implementation of the constructor. The file caches.txt is an example of the kind of file that the constructor should be able to process. Please note that I have included code that shows how to sort a list of Cache objects. Implement the methods. Please note that the partial implementation of getOwners I have provided shows how to sort a list of Strings. Test/debug/modify your CacheList and CacheListTests classes until you are certain that the CacheList class behaves according to its specifications. GeocacheBrowser If you have correctly implemented Cache and CacheList, your GeocacheBrowser should behave identically to the example implementation. If it doesn't, the problem is with either Cache or CacheList. Part 2 MyScanner In this part of the problem set, you are to design, implement, document, and test a class that provides objects that have a subset of the capabilities of Scanners. Your class must: Be called MyScanner and be in a package called scan Provide a constructor that takes a String as a parameter Provide four methods: hasNext(), which takes no parameters and returns a boolean next(), which takes no parameters and returns a String hasNextInt(), which takes no parameters and returns a boolean nextInt(), which takes no parameters and returns an int Not use Scanner in its implementation! A MyScanner should behave just like a Scanner would if you only used the Scanner's String constructor and its hasNext(), next(), hasNextInt(), and nextInt() methods. Be sure that you understand exactly how Scanners behave, including the circumstances in which exceptions are thrown. Don't simply assume you know how those methods interact. For example, hasNextInt() doesn't report whether there is an integer token somewhere in the Scanner; it reports whether the next token can be parsed as an int by Integer.parseInt(). You should read the relevant parts of the Scanner documentation (Links to an external site.)Links to an external site. and (probably more importantly) experiment with Scanners. Since there is no close() method, none of the MyScanner methods should ever throw an IllegalStateException. However, in the right circumstances some of the MyScanner methods should throw a java.util.NoSuchElement exception and/or a java.util.InputMismatchException. Be sure to test your MyScanner class thoroughly. Put your unit tests in a class MyScannerTests in the scan package. If I were you, I would write thorough test cases for the Scanner class. Then, when I was sure that my tests cases were correct and complete, I would do a global replace of "MyScanner" for "Scanner". But that's just me. Hint: Here is a bit of code that decomposes a string into an array of tokens: String[] tokens = s.trim().split("\\s+"); Here's how it works. It first "trims" the string, which removes all leading and trailing white space. It then splits the string into tokens. The parameter that is passed to split says that tokens will be separated by one or more white space characters.

acvtool icon acvtool

ACVTool is a novel tool for measuring black-box code coverage of Android applications.

android-mini-projects icon android-mini-projects

This repository consists of all the projects that I have completed in order to learn android development.

apktool icon apktool

A tool for reverse engineering Android apk files

facebook-page-post-scraper icon facebook-page-post-scraper

Data scraper for Facebook Pages, and also code accompanying the blog post How to Scrape Data From Facebook Page Posts for Statistical Analysis

flutter-googlemaps icon flutter-googlemaps

In this repo you will see how to integrate google maps in your flutter application using google_maps_flutter plugin .

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.