Regional Zone Information - Set Priority Rating

Feb 1, 2014

I have an assignment to complete where I have to develop a Java Console application in Eclipse which accepts regional zone information for premises based upon addresses provided. The program needs to figure out which geographical zone each customer lives in and based upon their age, set a priority rating.

The zones (which is the Belfast and the directions) and sub-zones (which are the Postcode such as "BT1" are:

Zones
BELFAST
"BT1 ", "BT2 ", "BT3 ", "BT4 ", "BT5 ", "BT6 ", "BT7 ", "BT8 ", "BT9 ", "BT10", "BT11", "BT12", "BT13", "BT14", "BT15"
NORTH
"BT39", "BT40", "BT41", "BT42", "BT43", "BT44", "BT45", "BT46", "BT51", "BT52", "BT53", "BT54", "BT55", "BT56", "BT57"
SOUTH
"BT25", "BT26", "BT32", "BT35", "BT60", "BT61", "BT62", "BT63", "BT64", "BT65", "BT66", "BT67", "BT68", "BT69", "BT70", "BT71", "BT80"
EAST
"BT16", "BT17", "BT18", "BT19", "BT20", "BT21", "BT22", "BT23", "BT24", "BT27", "BT28", "BT29", "BT30", "BT31", "BT33", "BT34", "BT36", "BT37", "BT38"
WEST
"BT47", "BT48", "BT49", "BT74", "BT75", "BT76", "BT77", "BT78", "BT79", "BT81", "BT82", "BT92", "BT93", "BT94"
UNALLOCATED
No Postcode provided

What I specifically need to do is

1.Display a count of addresses within a user defined geographical zone.
2.Display all information for customers within a user defined geographical zone.
3.Display a complete set of captured data.
4.Display a prioritized list of customer details within each geographical zone.
5.Display a count of customers within each geographical zone.

Below is the code I have created so far for it.

package assignment1;
 
import java.io.BufferedReader;
import java.io.InputStreamReader;
 public class Assignment1 {
 private static InputStreamReader input = new InputStreamReader(System.in);
private static BufferedReader reader = new BufferedReader(input);
 
[Code] .....

The main issue I'm having is to make sure that data like address and customer counts, and customer details appear only for the selected areas.

View Replies


ADVERTISEMENT

Calculation - Sorting Books By Rating

Jun 19, 2014

I have a calculation that sorts books by rating...

System.out.println("
" + "
Sorted by Rating
");
  for (int count = 0; count < bookL.size(); count++) {
for (int in = 0; in < bookList.size() - 1; in++)
if (videoList.get(in).getRating() < bookList.get(in + 1).getRating()) {

[Code] ....

What am I missing here? Why doesn't this work?

View Replies View Related

Java Time Zone Transition Period From EDT To EST?

Oct 28, 2014

Problem statement: Convert "2014-11-02 01:00:15 EST" to GMT.

This seems easy enough. But why is the below code giving the wrong answer?

Background:

* EDT aka GMT-4

* EST aka GMT-5

* 2014-11-02 01:00:15 EST == 2014-11-02 06:00:15 GMT

* If I user the commented out date string it works!!!

* EDT(until Nov 2, 2014 at 2am) -> at 2am we go to 1am EST

* If I use the below commented out from string it work!!! But these are equal (2014-11-02 01:00:15 GMT-05:00 and "2014-11-02 01:00:15 EST)

Code Example:

ZoneId gmt = ZoneId.of("GMT");
//String from = "2014-11-02 01:00:15 GMT-05:00";
String from = "2014-11-02 01:00:15 EST";
final DateTimeFormatter dateTimeFormatterone = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss z");
ZnedDateTime zonedDateTime = ZonedDateTime.parse(from, dateTimeFormatterone);
ZonedDateTime gmtzonedDateTime = zonedDateTime.withZoneSameInstant(gmt);
String result = gmtzonedDateTime.format(dateTimeFormatterone);

This is what the outcome is.

result == "2014-11-02 05:00:15 GMT"

Shouldn't it be

result == "2014-11-02 06:00:15 GMT"

View Replies View Related

Searching Binary Search Tree For Movie By Rating

May 8, 2015

The purpose of this function is to use a Movie object and a binary search tree to find all movies that have been read in through a file that have a certain rating (G,PG,PG-13,R). The error I am getting is that it seems I am not traversing fully through the tree and therefore only some movies with the rating I search for are output, not all of them with that rating. I have tried figuring out why this is happening and at first I thought my tree was unbalanced, but I am sure it is simply because I am not traversing the tree correctly. I think my implementation in the main is close to what I need but it needs some tweaking. This is my BST class which I created and required to use for this purpose.

public class BinarySearchTree {
/**
* The head of the tree.
*/
private Node root;
/**
* Constructor that declares the head of tree to null.
*/
public BinarySearchTree() {
root = null;
}
/**
* Returns null if head of tree is empty.
* @return null if head of tree is empty.
*/
public boolean isEmpty(){

[Code]...

View Replies View Related

Setting Default Time Zone In Select Form

Mar 19, 2014

I have the task which should set the default time zone in the select form. For this aim I use SimpleTimeZone class and write simple test to check my code. It is below

Java Code:

@Test
public void defaultTimeZone() {
String def = SimpleTimeZone.getDefault().getID();
boolean has = false;
for (String id : SimpleTimeZone.getAvailableIDs()) {
System.out.println(id);

[Code] ....

It works perfectly on win 7 and ubuntu, but falls on win xp. I know that win xp is not supported more but I still have some customers who use it.

View Replies View Related

Implement A Priority Queue

Apr 15, 2014

Implement a priority queue based on a sorted linked list. The remove operation on the priority queue should remove the item with the smallest key.

View Replies View Related

Print Queue Using Priority Q Simulation?

Nov 28, 2014

I have a class "ExecuteJob" which has Print Q in the form of Priority Q.

You can keep adding job to the Q by calling one of the method in the class. However, and object cant do things simultaneity can it? While im adding a new job to the print queue, can it be executing and existing job in the print Q.

To achieve that, I would need to implement process and threads? I believe am I right? So that adding a job is independent to being removed?

View Replies View Related

Priority Queue Implementation Using Heap / BST

Dec 4, 2014

I am in the process of implementing Priority queue, as I understand that there are many data structures you could use to implement. I implemented it with the an array, which it works absolutely fine. However I have limitations on what collections I can use from the collections classes. I fact I cant use any of the collections classes. Meaning I cant use array.

I’m trying to implement Priority Queue using heap. And implementing heap using binary trees. But however I have a few questions which I need to clarify and I cant think of any other way of resolving it. Ofcourse I can implement my own simple array class using linked list.

Inserting into heap would be quite simple, as I just need to find the right last position from left to right leaf to insert the node into the tree. However after inserting, you may want to make sure that leaf node values are > than root node. Therefore, the root node will always be with the highest priority.

I call these steps where you compare from top down as bubbledown and bubbleup. To do this I really need a for each node within the treee node to have attribute pointing to its root node. So in case of bubbleup I always have a pointer for a given node to its root, without it would mean I would to traverse through the entire tree to identify its root. Which I believe is very inefficient.

Or have I taken this completely wrong? Or is it the case that heap are only best with arrays and therefore use array (by implement it using linked list?)

View Replies View Related

Stacks And Priority Queues Project

Feb 21, 2014

So I have 3 classes in this project, and When it compiles, I get a null pointer.

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
public class Project2 {
 
[Code] .....

View Replies View Related

Sorting Priority Queue Containing Objects

Mar 30, 2014

I have a PriorityQueue called incoming, containing objects of type Vehicle.

All vehicles have a fuel level, that can be accessed by the getter method getFuelLevel().

I want to be able to choose to sort the queue so that the Vehicles with the lowest fuel levels are at the front of the queue.

View Replies View Related

Priority Queue In Java Which Keeps Track Of Each Node Position

May 4, 2014

I'm working on a lab for my class. I need to create a Priority Queue in Java using an array list. The kicker is that each node has to have a "handle" which is just an object which contains the index of of the node that it's associated with. I know that sounds weird but we have to implement it this way. Anyway, my priority queue seem to work fine except the handle values apparently aren't updating correctly because I fail the handle test. Also, I run into problems with handles only after extractMin() is called, so I figured the problem would be somewhere in that method but I've been through it a million times and it looks good to me.

Here is my Priority Queue Class:

package lab3;
 import java.util.ArrayList;
 /**
* A priority queue class supporting operations needed for
* Dijkstra's algorithm.
*/
class PriorityQueue<T> {
final static int INF = 1000000000;
ArrayList<PQNode<T>> queue;
 
[Code] ....

I can post the tests too but I don't know if that would do much good. Just know that the queue works as is should, but the handles don't point to the right nodes after extractMin() is utilized.

View Replies View Related

Comparable Class - Create Priority Queue For Airline Passengers

Oct 9, 2014

My assignment was to create a priority queue for Airline Passengers. Here is what I have done so far:

//Driver

package priorityqueuestandby; 
import java.util.NoSuchElementException;
import javax.swing.JOptionPane;
public class PriorityQueueStandBy {
public static void main(String[] args) {

[Code] .....

So the part that I cant figure out is:

When a standby passenger is to be enqueued into the priority queue, it must be done so that at the moment of each dequeue operation, the item at the head of the queue is the standby passenger with the longest longevity, and also so that passengers with the same longevity are dequeued in a first-come-first-served fashion.

he says that we need to "Make your program so that it extends Comparable and implements the compareTo() method properly..."

So I was looking at the Comparable class and I could't find a compareTo() method... I am not confident I know how extends works either. I am assuming I need a new class if I am going to be extending another class. Right now I am taking in longevity as a String and converting it to an int because my last ditch effort is going to be to set up a loop that will organize longevity into a/an circular array based on the size of the incoming integer.

View Replies View Related

Dijkstra's Algorithm With Priority Queue - Method To Find Minimum Distance Is Nonfunctional

May 14, 2014

I was given some code by a professor to add some features to as part of an assignment. However, the code itself doesn't seem to work.

import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;
public class DijkstraPriorityQueue

[Code] ....

The method to find minimum distance is nonfunctional...I receive an error that the types are incompatible. I can't do the assignment if the base code doesn't work to begin with...

View Replies View Related

Best Way To Store Information?

Jul 7, 2014

I'm doing desktop application about recipes. User can create new recipe, add information. I want to sort recipes, save them somewhere, maybe make it possible to send recipes over network to other users. But I don't know where and how store information about those recipes. I always used to use .txt files for storing needed information, but it seems that it is not the best option.

View Replies View Related

Pulling Information From A String

Feb 17, 2014

Pulling info from a string. I have a string which contains some results such as [United States of America 1 Netherlands 0, Canada 1 United States of America 1, United States of America 3 Russia 1, Norway 2 United States of America 1, Sweden 2 United States of America 4"]. Now based on user input I need to pull the numbers from this string and add them up. So if the user inputs United States of America it would pull 1,1,3,1,4 put that in an array and add it. I know how to sum the array just not sure how to get that information from a string,

View Replies View Related

Get Information From Array (Variable F)

Apr 8, 2014

I am trying to find the GCD, add, and remove the biggest and smallest fraction, however I am having trouble getting user input into the array and getting the information out of it (Variable f).

Scanner keyb = new Scanner(System.in);
Fraction[] frak = new Fraction[7];

Main_Class
try {
for (Fraction f : frak){ // for each array in frak print f;
System.out.println("Enter Numerator");
int num = keyb.nextInt();
System.out.println("Enter Denominator");
int den = keyb.nextInt();
f = new Fraction(num, den);

[Code] ....

View Replies View Related

2D Char Array - Getting Information From One To Other

Apr 10, 2014

I'm trying to take the information from one 2d char array and put it into another char array but instead of traversing the array left to right I want the new array to be top to bottom.

Example fg would be fh
hi gi

I'm having trouble getting the information from one to the other.

[code]public static char[][] translateIt(char[][] english){
int rows = english.length;
int columns = english[0].length;
char[][] chinese = new char[columns][rows];
for(int j=0; j < columns; j++){
for (int i = 0; i < rows; i++){
//chinese[i][j] = english; this is commented out because it didn't work.
}//Ending bracket of columns for loop
}//Ending bracket of rows for loop

return chinese;
}//Ending bracket of translateIt[code]

View Replies View Related

Program That Is To Store DVD Information?

Nov 11, 2014

i have a program that is to store DVD information and when i enter all the information asked it returns no info. I have a DVD inventory file and a DVD extended file.

DVDinventoryprogram class
package inventory2;
import java.util.Scanner;

[Code]....

View Replies View Related

How To Get Information Back From A Different Method

Nov 12, 2014

I am trying to figure out how to get information back from a different method.

Basically I want to write a program to create a car, but I want to be able to add features based on user our put (V6 versus V8, Color choice, etc), but I want each one to be broken out into their own method but I am unsure of how to call from the main method and return the variable (engineSize = V8, color = blue, etc).

View Replies View Related

SwingGUI - Display Large Information Set

Aug 16, 2014

I have a simple display method in a java project as given below:

public void displayInfo() {
for(Student student : studentdB){
System.out.println(student.toString() + "
");
}

I would want to use one of Swing components to display the students instead of displaying them on the stdout. How I could go about calling this method in some Swing components that can display all the students in the studentdb?

View Replies View Related

Formatting The Way Array Information Is Displayed

Mar 21, 2015

import java.util.*;
public class TrafficIncidents {
public static void main(String[] args) {
Scanner s = new Scanner (System.in);
// Array for days
String [][] days = {{"Sat"},

[Code] ....

This is my output:

Day AM PM
--------------------------------
Sat
Sun
Mon
Tues
Wed
Thurs
Fri
5 1 1 2 4 1 0

Basically I want to align the AM traffic incidents under the heading "AM" but am not sure how to accomplish this. I am using separate arrays for all three of these types of information and need the info to line up with their respective titles.

View Replies View Related

Adding Information To Array Dynamically

Apr 29, 2015

I'm having trouble conceptualizing something. I will post the code, it's works exactly as it should. I create an array and Hash Map to display periodic table of elements information after allowing the user to search by element name or symbol. I want the user to also be able to add elements to the periodic table. I can't really conceptualize how I am going to do that with an array I've already created.

Here's code:

//Create element objects.
//Here is where I create my "elements" array, and where I could like to prompt the user to add elements, if desicred.
Element[] elements = {new Element("Hydrogen", 1, "H", 1.008,1,1), new Element("Lithium",3, "Li", 6.94,2,1)}; //
//Maybe it seems if I prompt the user here to add new element names, symbols, weights, etc, I would be overwriting

[Code] .....

View Replies View Related

Read Information From File - How To Get Highest Value

Nov 12, 2014

The requirement asked me to write a Java program to read information from the file, display the original information along with the player's average score of the season (one line for each player), and announce who is the highest average-scoring player of the team. But I always only get the highest which show the last player.

Such like the output showed:

Smith 13.0 19.0 8.0 12.0 Player's average: 13.00
Badgley 5.0 Player's average: 5.00
Burch 15.0 18.0 16.0 Player's average: 16.33
Watson Player's average: 16.33
Knox 10.0 12.0 8.0 6.0 Player's average: 9.00
Casler 15.0 7.0 Player's average: 11.00
Winorburg 13.0 14.0 14.0 23.0 20.0 Player's average: 16.80
Morton 4.0 11.0 13.0 Player's average: 9.33
Seeling 16.0 8.0 9.0 11.0 Player's average: 11.00
Tanshi 5.0 13.0 10.0 Player's average: 9.33

The highest average-scoring player is: Tanshi

import java.util.Scanner;
import java.io.*;
public class PA7{
public static void main(String[] args) throws IOException{
String name = null;

[Code] .......

View Replies View Related

Passing Information To A Method Or Constructor

Feb 28, 2014

Passing Information to a Method or a Constructor

They show a line of code that goes like this:

public Polygon polygonFrom(Point[] corners) {
// method body goes here
}

So from what I understand this is a constructor method for a Polygon object from the Polygon class. What I dont get is the name of the method polygonFrom()

Shouldn't a constructor for a Polygon just have the same name as the class? Because from earlier examples in the tutorial it seems to me that this is what has been done

For example:

public Bicycle(int startCadence, int startSpeed, int startGear) {
gear = startGear;
cadence = startCadence;
speed = startSpeed;
}

View Replies View Related

How To Retrieve Information From Poker Sites

Apr 20, 2015

I am pretty new to java and where I should start. What I am trying to do, is to retrieve live information from poker sites as I play, typically my hand and the pot size. Is this possible? I know poker sites probably are very secure, but I can see those things (my hand, and the pot) anyway, I just want it to happen automatically. What I am trying to do, is to create a program that retrieves the information, and then calculate the odds of me winning.

View Replies View Related

JSF :: PrimeFaces Accordion Panel Information

Aug 13, 2014

I have an JSF that uses primefaces accordion snippet. However I want to populate the information from each tab from a seperate webpage that would also have accordion snippet in it. I can do this on a single page no problem, but the length of the program (webpage) is getting to the point that it is unmanageable.

The code I have:

<p:layoutUnit position="center">
<p:accordionPanel activeIndex="null">
<p:tab title="Burglar">
<h:outputText value= "Burglar"/>
<p:accordionPanel activeIndex="null">
<p:tab title="Skills">
<h:outputText value= "Skills"/>

[Code] ....

What I am after:

<p:layoutUnit position="center">
<p:accordionPanel activeIndex="null">
<p:tab title="Burglar">
<h:outputText value= "Burglar"/>
<p:accordionPanel activeIndex="null" url="burglar.xhtml">
</p:accordionPanel>

[Code] ....

How to get this to work... I am sure that it has something to do with my url but not sure how to fix it and I can not find anything on the web on how to do this.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved