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


ADVERTISEMENT

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

Read ASCII Art Map And Store Information In 2D Array

Feb 12, 2014

I've written some code to do this, but it's not working as I expect. This is what the ASCII map looks like:

###################
#.................#
#......G........E.#
#.................#
#..E..............#
#..........G......#
#.................#
#.................#
###################

Here's how I've tried to store the information in a 2D array:

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
 public class Map {
 public void importMap() throws IOException{
BufferedReader br = new BufferedReader(new FileReader("map.txt"));
String line;

[Code] ....

But it's not printing out what I'm expecting. It's printing out:

[[#, #, #, #, #, #, #, #, #], [#, #, #, #, #, #, #, #, #], [#, #, #, #, #, #, #, #, #], [#, #, #, #, #, #, #, #, #], [#, #, #, #, #, #, #, #, #], [#, #, #, #, #, #, #, #, #], [#, #, #, #, #, #, #, #, #], [#, #, #, #, #, #, #, #, #], [

What is printed is much larger than what I've copy and pasted but I can't post it all here.

The error I get is:

Exception in thread "main" java.io.IOException: Stream closed
at java.io.BufferedReader.ensureOpen(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at Map.importMap(Map.java:26)
at Map.main(Map.java:44)

View Replies View Related

Read Characters From Txt File / Store Them Into 2D Array And Print Information

Oct 10, 2014

The point of this program is to read characters from a txt file and store them into a 2D array. After this has been accomplished, the information is to be printed in the same manner it is read from in the txt file.

Here is the code I have so far:

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main
{
public static void main(String[] args) throws FileNotFoundException

[Code] ....

And this is the error I am receiving when trying to accomplish the goal of the project:

Exception in thread "main" java.lang.NumberFormatException: For input string: "############"
at java.lang.NumberFormatException.forInputString(Unk nown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at Maze.<init>(Maze.java:15)
at Main.main(Main.java:20)

What's going on here and how I can correct this?? The information I am trying to store in a 2D array and then print is this:

############
#.#........#
#.#.######.#
#.#....#...#
#.###.*#.#.#
#...####.#.#
#.#.#..#.#.#
#.#.#.##.#.#
#o#......#.#

View Replies View Related

Program Should Read File Contents And Store Information In Array Of Golfers

Dec 3, 2014

The main method will drive your program by doing the following:

-Create an array to hold all the individual golfers and par scores (type is Golfer[ ]).
-Prompt the user for a data file containing the Par scores and the player names and score. The format of the input file should look like

Par, 3, 4, 4, 3, 4, 3, 5, 3, 4
George, 3, 3, 4, 3, 4, 2, 3, 3, 4
Paul, 4, 5, 4, 3, 6, 3, 4, 3, 5
Ringo, 3, 3, 4, 3, 4, 2, 4, 3, 4
John, 4, 4, 4, 3, 4, 2, 5, 3, 4

Your program should read the file contents and store the information in your array of Golfers.

View Replies View Related

Write A Java Program To Store Employee Information In A Linked List

May 12, 2015

Write a java program to store employee information in a linked list, the program should implement the following functions:

The program should display the list of functions, and ask the user to enter the number of function that he/she wants to do, then perform the function as it is required in the previous table.

import java.util.*;
public class Employee {
Scanner in = new Scanner(System.in);
String Name;
String Address;
String Department;
int ID;
int Salary;

[code]....

this is my out put

Please choose a number:
1-Add a new employee
2-Update employee's info
3-Remove employee's info
4-Exit
1
Enter name:
Enter address:
2
Enter department:
3
Enter ID:
4
Enter salary:

now:

1- why are not my adding coming out in the output only the Enter name & Enter address ??

2- how can I add names and ID's and information to test that program

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

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

Inventory Program - Display Information To GUI

Feb 28, 2015

I am trying to create a GUI with already existing code. My assignment is: Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the GUI should display the value of the entire inventory, the additional attribute, and the restocking fee.

Where to start. The text book does not cover a GUI that displays this type of information rather it just displays graphics. I would like to create a separate class that holds the GUI information just to make everything flow better. I have provided my current code below:

Java Code:

// ProductTest.java
// by JakeB
public class ProductTest {
// main method begins
public static void main(String[] args) // begin main {
myGUI display = new myGUI();
display.setVisible(true);

[Code] .....

This is all I have for the GUI. I am at a total loss and I am behind 2 weeks now. I cannot move forward until I am able to get this done and the class ends next week.

View Replies View Related

Extract Information From Java Project

Mar 4, 2015

I should do, for my academic project, draw from a java project some information, for example, the class name and the relative method, and for each class even the package name where the class is. The information found must be saved an XML files...

View Replies View Related

Contact Information - How To Utilize Objects

Jun 14, 2014

I'm trying to create contact information as object and another object as parcel then calculate the shipping fee. Problem is I don't have a good understanding in implementing object type to my code. Attached are what I've done and I know that my constructor in my parcel class and contact class are probably wrong too but I don't know what to do with it.

//contact class
public class Contact {
private String Name;
private String Address;
private String City;
private String State;
private double Xco;
private double Yco;

[Code] .....

View Replies View Related

How To Develop Student Information Page On Web

Oct 3, 2014

Below mentioned table which show data on WEB page, thereof i need to develop page for my practice, steps to develop this like as following.

1.Tool Required to develop
2.Connectivity JDBC
  
create table student
(ROLLNO   NUMBER,
NAME     VARCHAR2(20),
DOB      DATE,
REG_DATE DATE,
ADDRESS  VARCHAR2(100),
PIC      LONG
)
 
INSERT INTO STUDENT VALUES(1,'ALI',TO_DATE('01-JAN-1982'),SYSDATE,'','');
INSERT INTO STUDENT VALUES(2,'JHON',TO_DATE('01-JAN-1985'),SYSDATE,'','');
INSERT INTO STUDENT VALUES(3,'CHARLI',TO_DATE('01-JAN-1990'),SYSDATE,'','');

View Replies View Related

Insert Information From CVS File In Postgres Table?

Mar 15, 2015

I am trying to insert information from a CVS file in a postgres table and I have this exception:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at crislicenta.automateImport.main(automateImport.jav a:29)

and the cod line is: db.importData(conn,args[0]);

The source code:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
 public class automateImport {
static final String JDBC_DRIVER="com.mysql.jdbc.Driver";
static final String DB_URL="jdbc:postgresql://localhost5432/";

[code]....

View Replies View Related

ArrayList - Contact Information / Address Book

Jul 5, 2014

I have a question about arraylist objects.... I want to create an address book that will contain a persons information (name, phone, address, email..etc..). The first two snippets of code are from the same class ContactArrayList and the last one is from the class Contact. Do I need to create a separate arraylist for each data type? Is it possible to use a single arraylist to contain all the object (person) information and then be searched for using a GUI? I would also like to be able to access this data to be manipulated using a JFrame (add, edit, and search).

public class ContactArrayList<E> implements List<E> {
public int size, capacity;
E contact;
private E[] contacts;
public ContactArrayList() {
size = 0;
capacity = 20;

[Code] ....

View Replies View Related

Display More Information When Node Is Clicked In Jtree?

Aug 27, 2014

I'm new to java and I'm currently trying to make a program that uses a JTree that implements a properties file. I have the Keys set to the nodes but I want it so that when the node is clicked it will retrieve the keys value from the prop file.

I did have some code for this initially but I as it did not work at the time and was causing issues to my project I got rid of it. I have my code for the jtree,the listener and the prop file.

Tree

Java Code:

JPanel panel_1 = new JPanel();
panel_1.setBackground(Color.WHITE);
panel_1.setSize(new Dimension(22, 0));
scrollPane.setViewportView(panel_1);
Properties properties = new Properties();

[Code] ....

Java Code: add = Adds files changes in your working directory to your index. Example: git add .

rm = Removes files from your index and your working directory so they will not be tracked.

Example: git rm filename mh_sh_highlight_all('java');

Is there a way of doing this? Been trying for a while now but to no prevail. The image is what it currently looks like

View Replies View Related

Taking Information From Google Doc And Storing To Be Able To Print Later

Jan 20, 2015

I've looking for information on taking a range of data from a google sheet such as the one below.

JavaGroupCat.png

The function that i'm trying to accomplish is allowing a user to run the program and input their 5-digit Unique - ID. After inputting their 5-Digit ID the program will take that input, and check whether or not that ID is present on the spreadsheet.

Ex: (Using the numbers from above) I type in : "89504" then (I would want the program to spit out if the ID is on the sheet).
(89504 appears on the sheet) So i would want it to print out something like "ID is found on list "Cat".
Associated named include: "Phil Roberts".

I tried, with my limited knowledge, to create what I have described above.

import java.io.*;
import java.util.*;
public class SwitchesTwo
{
public static void main(String args[]) {
System.out.println("Welcome to the ID # Checker");
System.out.println("Enter the ID of the person you are trying to verify");

[Code].....

The issue I have with the mock-up above is the fact that I have to manually add in every individual name and ID. I would much rather write code that would allow it to update as I update the spreadsheet. Therefore, no need for 800+ cases. (theres around 800 ID numbers for this project)

In a perfect world, the code would be something like "Take info from cells C5 - C2000 and store as string array" (I think array would work.) while also doing the same with B5 - B2000.

View Replies View Related

Linked Lists - Reading Information From A File

Oct 29, 2014

Basically, the program is to be able to read information from a file like this;

11111 63.5
22222 59.9
33333 82.4
44444 73.1
55555 77.3
66666 99.5
77777 68.7
88888 53.2
99999 66.8

where the first number is student number and the second is their grade. I need to read this information from a .txt file and dynamically create a new node containing that student's number and mark, and insert it in the correct position in the linked list (in descending order based on grade). So I get that each Node needs to contain two data types, an Int for Student # and a Double for their grade, and I'm pretty sure I've done it correctly with my StudentNode class which can be found in the source code linked above.

But what I don't get it using that class to create Nodes in my main class and then sort them based on their Double grade value WHILE they are being sorted. I just don't understand where to actually put the methods and such that does these things. Apparently I'm supposed to have three classes.

One named StudentNode which is just the node info, which I have done.

The second is called StudentList which is apparently supposed to contain the head of LinkedList and the methods I need? I'm not sure how it ties into StudentNode though.

The third and final is just the main class which I'll use to test it.

Then after all that I need to print out the median mark through a recursive method that isn't allowed to use any loops or call and functions/methods that use loops. The function should return the node in the list which contains the median mark. Secondly, in order to find the median, you need to know how many items in total are in the list. Your recursive function must calculate that number (also recursively); you may not keep track of this count elsewhere your program. Your recursive solution should only examine each node only once, and the depth of the recursion should be equal to the number of nodes in the list.

Here's my current in-progress code.

import java.io.FileNotFoundException;
import java.util.Scanner;
class StudentNode {
private int studentNum;
private double grade;
private StudentNode next;

[Code] .....

I'm pretty sure the StudentNode class is fine, it's the StudentList class that I'm not sure about. I'm not sure how to add nodes since there isn't a getNext() method in the StudentList class.

View Replies View Related







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