Create A Program That Keeps Track Of Information Input By User

Sep 17, 2014

I am new to Java an have to Create a program that keeps track of the following information input by the user: First Name, Last Name, Phone Number, and Age. Now - let's store this in a multidimensional array that will hold 10 of these contacts. So our multidimensional array will need to be 10 rows and 4 columns.You should be able to add and remove contacts in the array.

View Replies


ADVERTISEMENT

Program That Will Allow To Enter Information From Form To Keep Track Of Attorney Who Signed Up

Jan 13, 2015

I work for my local probate court, and one service we offer is email reminders. They fill out a form, it's entered in the system, and they will be notified when something is due. I've been allowed to create a program that will allow me to enter the information from the form to keep track of the attorney's who have signed up.

import java.sql.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;

public class Attempt1 {
public static void setConnection() throws SQLException {
Connection conn = null;
Statement state = null;

[Code] ....

The issue I have is the method setQuery. It displays a table with the data entered. Where it currently sits at line 21, it does not display the table, nor does it seem to terminate the program. The goal was to update the table with a few entries, and then display the Jtable. When placed above the setInsert method, it displays just fine, and will reflect the new entries added the next time you start it. I'm still learning Java outside of a classroom environment on my own, so I can only imagine that this is riddled with poor coding, but I just can't seem to figure out why it doesn't display the table after the setInsert method is called. In it's current state, this program is just meant to test functions of SQLite with Java. From there it will be created with a GUI.

View Replies View Related

Adding User Input To File - Information Overwritten?

Dec 8, 2014

I need to write a program that will let a user input name, age, email, and cell phone number, and commit the input to a text file. They need to add multiple entries. I figured out how to create the file and write to it, but when the user enters a second set of information, the first is overwritten. How can I make the file be added to instead of overwritten? The following is my code:

try
{
FileWriter writer = new FileWriter("ContactInformation.txt");
BufferedWriter bw = new BufferedWriter(writer);
nameTextField.write(bw);
bw.newLine();

[Code] ....

View Replies View Related

Arrays With User Input - Sorting Information Correctly?

Oct 12, 2014

I am new to using arrays. I need to collect user input for book title, author, and # of pages... store that in an array... and then I'm going to need to be able to sort that array. The dialog boxes come up prompting the user for 5 sets of title, author, and # of pages, but when I try to display that information, it isn't working. I am assuming this means that it's not storing the information correctly... so I want to get this corrected before I even try to sort??

import javax.swing.*;
import java.util.*;
class LibraryBookSort
{
public static void main(String[] args)
{
LibraryBook[] someBooks = new LibraryBook[5];

[Code] ....

View Replies View Related

Edit User Information By Bringing In Input Fields From Database Using JSP

Jul 11, 2014

I can insert data in database, delete aslo using JSP. But facing problem while updating the information saved in database as m using MySQL 2008. I want to see the bring saved in database with particular username into the updateinfo.jsp form.

View Replies View Related

Variable Fields Are Not Holding Information Through Constructor From User Input?

Oct 19, 2014

Variable Fields are not holding information through constructor from user input so here's what I did instead.

View Replies View Related

User Input Student Information - Print Out Name With Grade In Descending Order

Nov 23, 2014

I had to make a program that allowed the user to enter the number of students and the students names and grades and then print out the name with the grade in descending order. right now I only have it where it prints the names out in descending order. how do I get it the print out with the grade?

Here is my code

import java.util.*; 
public class Grades {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the number of students: ");
int numofstudents = input.nextInt();

[Code] .....

View Replies View Related

Boolean Method - Adding Information To Mailing List Based On User Input

May 5, 2014

This program contains a superclass and a subclass that will gather the following information from the user:

name, address, phone number, and customer number.

Everything works fine except that I have to create a boolean method in this program that is required to determine based on user input whether they want to be added to a mailing list.

I cannot get this method to work with main, each time it is called it will always return the value but main will constantly read the last statement (else, where it will read "not wanting to be added to the mailing list).

The only way I can get this part of the program to work is by adding an equals method in main that ignores the case, but I am required to write a boolean method so this is not allowed.

Superclass:

public class Person
{
private String name;
private String address;
private String phoneNum;
public Person(String pName, String add, String number)
{
name = pName;
address = add;

[Code] ...

View Replies View Related

Inventory Program - Displaying Information (Input From Array)

Sep 13, 2014

I'm working a an assignment for my IT/215 class and I'm having a little trouble with my arrays. My code compiles just fine but when it comes to displaying the information I've input into my array it doesn't seem to want to and I'm not sure what I'm doing wrong here. On line 136 originally I had [DVDs [count] = count+1]] but it wouldn't compile. I then put line 136 to [ DVDs[count] = new Inventory();] and I think that's were my issue is but I'm not sure....

// Purpose:the purpose of this software is to display inputs as wells as the stocks and price of inputs.

class Inventory
{
private double ItemNumber; //to store Item number
private String ItemName; //to store Item name
private double UnitsInStock; //to store number of units in stock
private double UnitPrice; //to store Unit price
private double InventoryValue; //to store Inventory value
private double TotalInventory; //to store Total Inventory value

[Code] .....

View Replies View Related

Calculator Program - Print Heart Rate Ranges And User Information

Jan 26, 2014

I am attempting to make a heart rate calculator program. Here is a little overview of what I am trying to do. It must use a constructor and get and set methods. It must print heart rate ranges and the user's information(age).

// Use scanner to get inputs
import java.util.Scanner;
 
// Declare class
public class HeartRates {
private int Age;
private int DayOfBirth;
private int MonthOfBirth;
private int YearOfBirth;
private double MaxHeartRate;
private double MinTargetHeartRate;

[Code] ....

View Replies View Related

Create Program That Prompts Input And Creates File With That Input As Name

Jul 14, 2014

So I was going to try to create a program that prompts input and creates a file (That didn't exist before) with that input as name.Then, the program prompts inputs after stating questions such as 1 + 1, then if the user inputs an answer, put "Question # = Correct "or" Wrong.Code SO Far:

Java Code:

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
public class File_Read {
public File_Read() {//File_Read is the Interactive object

[code]....

So that it puts the Correct or Wrong into the file.

View Replies View Related

Java Program That Will Ask A User To Input Grades Until User Inputs Sentinel Value

Apr 9, 2014

Write a java program that will ask a user to input grades until the user inputs the sentinel value -1. The program should test each input to determine whether 0<=grade<=100. If the grade entered is within this range, the program should print "Grade accepted;" if not, the program should print "Invalid input".

View Replies View Related

Program That Takes User Odd Number And Print Prime Numbers Lower Than User Input

Nov 4, 2014

I have been struggling with this program for weeks. This program is supposed to take a user's inputted odd number and then print out all prime numbers lower than that number.

public class PrimeNumber
{
Scanner scan = new Scanner(System.in);
int userNum;
String neg;

public void getUserNum()

[code]...

View Replies View Related

How To Get User Input And Create Variable

Sep 16, 2014

Okay, so I know how to get user input and create a variable from the input, create a basic addition sum etc...

So I have this code:

package calc;
import java.util.Scanner;
class calc{
private static final double add = 0;
private static final double subtract = 0;
public static void main(String args[]){

[Code] .....

I'm basically trying to make it so that when the user enters tnum, tnum2, tnum3 and tnum4, their answer turns to the variable which has to be either true or false to make the boolean work. I don't know really how to do this. I want to make it so that if they enter yes, then that makes the boolean true and the numbers will multiply and create the answer variable. If they enter no then the boolean is false and it moves onto the next if statement. How can I do this?

View Replies View Related

Reading User Input From JTextField As Int To Create Matrix

Sep 16, 2014

I am required to read user input to create two matrices which will eventually be added together. I am unsure as to how I can read the input from the user as an int and not a String. The input is from size 0-10 for both column and row size. Also, can you have a new button created in the actionPerformed method of a previous button?

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class Matrices implements ActionListener {
private JFrame win1, win2, win3, win4;

[Code]...

View Replies View Related

Generate QR Code From Input Text And Display Information About Input / Output Bits

Nov 12, 2014

I am trying to write a program that will generate a QR Code from an input text and also display some information about the input/output bits. So far I have created the frame and what to do next. And I'm not sure if I am on the right track since my level of programming is not that great. By the way, I am using zxing libraries from GitHub. I know, there are plenty of generators online for the QR Code, but that is not what I am looking for. As you can see on the attached image, I am more interested in the efficiency of encoding 2D data. Also, I noticed that almost all the online projects regarding 2D codes are for Android. Which is not very useful.

// QR Code Generator
package qrcode;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;

[Code]....

View Replies View Related

Create A Program That Asks User For Array

Mar 3, 2014

i need to create a program that asks the user for an array and then asks the user to fill in the slots of the array but i have to do it in a method

View Replies View Related

Create A Program That Allows User To Enter A Day Using A Number

Oct 13, 2014

so I had to create a program that allows the user to enter a day using a number and then enter a year and after they did that it would create an entire calendar for that year ..so I have that but the only issue is I can not get the numbers to line up neatly.how to do the entire thing in loops, I tried a couple in here..what this would look like as loops instead of switches and cases and if else

import java.util.Scanner;
public class Calendar {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
 
[code]....

View Replies View Related

Program Skipping Over User Input

May 19, 2014

So i'm just toying around with making a simple inventory system, and when i'm trying to get the user's input (first the ID number, then the item name, then the item price) it will take the ID number, output asking for the name (but not take any input for it) and then ask for the item's price. I'm really not sure why it's never happened to me before when getting user input.

This is the input part of my code:

public void getInfoAdd() {
int id;
String name;
double price;
System.out.print("Enter ID: ");
id = sc.nextInt();
System.out.print("Enter item name:");
name = sc.nextLine();
System.out.print("Enter desired price: ");
price = sc.nextInt();
addItem(id, name, price);
}

And this is what it outputs:

Quote
Enter ID: 2
Enter item name:Enter desired price: 40
Successfully added: 2 $40.0

View Replies View Related

Writing A Program To Take Input From User?

Oct 23, 2014

Writing a program to take input from user. This input must be done with numbers only. If the input is a string I would like the program to loop and ask for input again.

double depositCheckingAmount;
do
{
System.out.println("Please insert amount to deposit into checking.");

[Code]....

As you can see my attempt is to use the ! expresssion incase the input does not equal a double. Is there another method I should be using?

View Replies View Related

How To Exit A Java Program If User Input Nothing

Apr 17, 2014

How do i exit a java program is the user input is nothing "",This is my code

Java Code:

import java.util.Scanner;
public class MyQueue<T> implements Queue<T> {
private T[] ringbuffer;
static int capacity = 0;
int mysize = 0;

[code]....

View Replies View Related

Servlets :: How To Track Client IP Address From Where User Requested To Application

Jan 28, 2014

I need to track the client IP address from where user requested to my application.

I tried following:

request.getHeader("HTTP_X_FORWARDED_FOR"));
request.getHeader("X-Forwarded-For"));
request.getHeader("Proxy-Client-IP"));
request.getHeader("WL-Proxy-Client-IP"));
request.getHeader("HTTP_CLIENT_IP"));
request.getHeader("HTTP_X_FORWARDED_FOR"));
request.getRemoteAddr());
String ip = InetAddress.getLocalHost().getHostAddress();

In which InetAddress is giving my local machine IP when i run my application in localhost, but I mapped localhost:8080 with IIS server then InetAddress not giving exact IP address. How can we resolve this?

View Replies View Related

Possible To Create Program With JAVA That Uses Algorithm To Summarize Data Input

Jan 23, 2015

So I was just wondering if it's possible to create a program with JAVA that uses an algorithm to summarize data inputed. I've never done something like this before, If this is not possible with Java is it possible with C++ or any other language??

View Replies View Related

Bank Account Program - Processing User Input

Oct 28, 2014

So the assignment is as follows. Develop a new class called BankAccount. A bank account has the owner's name and balance. Be sure to include a constructor that allows the client to supply the owner's name and initial balance. A bank account needs - accessors for the name and balance, mutators for making deposits and withdrawals. I have the following code :

import java.util.Scanner;
public class BankAccount{
public static void main(String [] args){
Scanner reader = new Scanner(System.in);
double name;
double balance;
double deposit;
double withdrawl;

[Code] ....

I am having trouble with my if statements. I don't know how to link the number 1 & 2 keys to deposit and withdrawal actions. Plus I am supposed to have a while loop yet don't know how to implement this so that the while loop will ask the user if they would like to make another transaction after either depositing or withdrawing.

View Replies View Related

Write A Program That Reads From User Several Lines Of Input

Mar 24, 2014

a. Assume that we have a list of employees' names of a company and their ages. Write a program that reads from the user several lines of input. Each line includes an employee's name and his/her age (as an integer). The program should calculate and print the following:

- The average age of all employees (rounded to 2 decimal places).
- The oldest employee and his/her age.

Hints:

You could assume that the user will insert valid data and at least one employee.
You could assume that the oldest employee is only one person.
User could stop the program via entering the word "end" as an employee's name.

Sample Input and Output: In each line, insert an employee's name and his/her age To halt the program, insert "end" as an employee's name

Adam 30
Tom 41
Ted 45
Karl 30
end

The average age of all employees is 36.50.The oldest employee is Hisham whose age is 45

View Replies View Related

Program For Class To Request User Input For Base Salary

Feb 24, 2014

I had to write a program for class to request user input for base salary, number of years worked, and total sales. Then use the data to find out the employee's paycheck when including a bonus. I have a few issues with the code, as I have one bug, then it won't calculate anything. what I'm missing?

package chapterone;
import java.util.Scanner;
public class Examplelab {
static Scanner console = new Scanner(System.in);
public static void main(String[] args){
double baseSalary;
double noOfServiceYears;
double totalSales;

[Code]....

View Replies View Related







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