Basic Console Java Program - Generate Employee ID

Feb 27, 2014

Basic console java program. I need to generate an employee id. I have an employee class that I will paste here so you can see my fields and constructors.

public class Employee {
private String firstName;
private String lastName;
private int id;
public int nextUniqueId = 0;
public Scanner sc = new Scanner(System.in);

[Code] ....

View Replies


ADVERTISEMENT

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

Eclipse Java Program Console GUI?

Aug 15, 2014

im wanting to create a console gui that opens with my program game and people can type stuff in it to run commands as well as a debug option to show when errors happen and have a command to list all availble command.

View Replies View Related

Create Class Employee Which Contains A String Variable Employee Number

Jul 13, 2014

I have searched for totalPay is always 0 and the responses are not related to my problem (that I can tell).This is a class assignment and I have other questions besides why the method is not working.

Here are the instructions: Create class Employee which contains a String variable Employee Number, a String variable Employee Name, an integer Hours Worked, and a double Pay Rate. Create get and set methods for each variable. Provide method "totalPay" which calculates and returns the total pay by multiplying the hours worked by pay rate. Use figure 8.12 as an example of an object with get and set methods.

Unlike other examples of this type question online this one has Employee Number as a String variable. The book is How to Program Early Objects by Deitel 9th edition.We have instructions to do only what she has told us too. At this point it is objects and getter and setter methods. It is only the beginning of week 2.

ON THE LINES WHERE I HAVE QUESTIONS I AM COMMENTING IN ALL CAPS. NOT SHOUTING, JUST TRYING TO MAKE IT EASIER

package test11;
import java.util.Scanner;
public class Test11 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

[code]..

Essentially I cannot figure out how to get the method getTotalPay to be called by the Scanner and do the math. I also have this random bracket problem that showed up about an hour ago.

The concept I don't get is that if I omit this.employeeNumber =id; etc. I error all over the place. If I change it to this.employeeeNumber = employee Number Netbeans tells me it is assigning itself to itself, which I know. When I try to use id instead of employeeNumber I get errors all over. If i remove "this" from it the same happens. why in public class employee I have to change to those values (id, name, etc) in the construct and set them again? I don't see where or how they can be used, so why do i have to do it?

View Replies View Related

Java Program To Generate Data Along With Outliers

Mar 4, 2015

I am currently concentrating on Java programming skills. Right now developing a Energy usecase in Java with Spring framework. Have business requirement to generate data along with outliers. For example, have two parameters called as min and max (centigrates). Generate a file between min and max and store in a file. Atleast need to generate 10 outliers in each 100 records. Outliers should be < min and > max. How to write a java class with this business condition. The file should be like,

Java Code:

Public class DataGeneration(int min, int max)
where min = 30
max = 50

UNIX_TIME_STAMP< >DEGREES
98938409384389384< >30
39083048938409384< >49
39583980398493840< >-30
90853948093849383< >100 mh_sh_highlight_all('java');

From above sample data file, it will be generating two outliers. How to create such kind of data generation in Java class?

View Replies View Related

JAVA Program That Will Generate A Random Phone Number

Mar 12, 2014

Instruction: You work for a telemarketing company and you are required to write a JAVA program that will generate a random phone number. (talk about a real-world application)

-The phone number should consist of 10 digits
-The first 3 are the area code and should not begin with 0, 8 or 9
-The second 3 digits should not be greater than 742 and not less than 100.
-The last 4 digits can be any digits
-Print the number using the following format: "(xxx)-xxx-xxxx", this way it will look like a real phone number (use decimal formatting)

by this : Generating Random Numbers
Using arithmetic operations

View Replies View Related

Java App To Open A Console Base Program And Run A Command

Jan 13, 2015

I am struggling getting my java app to open a console window on either MacOS or windows and run a command. On windows I can get the cmd.exe program to open, but it won't execute the command. On MacOS, I cannot get it to even open the terminal.

String run = "c:
s34bil.exe
elap5.exe" + in + rst + out; //in, rst, out are parameters for the relpa5.exe file.
try {
Runtime rt = Runtime.getRuntime();
rt.exec(new String[]{"cmd.exe","/c",run,"start"});
} catch (IOException ex) {
Logger.getLogger(issrsUI.class.getName()).log(Level.SEVERE, null, ex);
}

View Replies View Related

Exporting A Java Program From Eclipse That Only Runs In Console

Oct 11, 2014

I have recently revisited a program I wrote a few years ago, that runs absolutely fine in the console in Eclipse. However, when I export it as a Runnable Jar File, then open the file on my Desktop, nothing happens.How do I get the program to export so that when I open the file, a window opens that acts as the console (so the program can run in it)?

View Replies View Related

Program That Displays Information For Employee Objects Of Different Types

Apr 29, 2014

I'm making a program that displays information for "employee" objects of different types. This works with a hierarchy that goes Person→ Employee→ Fulltime/Adjunct, and a driver that tests the inheritance. The Person class is given and only supplies the name, the employee class manages the year hired and the ID, and the types of employee classes manage the salaries.

One object (called staff[2]) is supposed to first be printed with default information and then later updated via set methods. I figured out how to update the name, but I don't know how to update the rest of the information because the employee's name is managed in the Person class and the reset of the information is managed in the less-general classes, and the objects are all in an array of Person.

How do I call the set methods necessary to update more of staff[2]?Output (scroll to see the updating section)

The current year is 2012

Name: Flintstone, Fred
ID Num: BR-1
Year Hired: 2005
Years Of Service: 7
Salary: 65000.12
Fulltime Type Employee

[code]....

View Replies View Related

Basic Prime Factorization Program

Dec 10, 2014

What's wrong with the code.

public class alltheprime {
public static void main(int a) {
int i, j, k, l, m;
m=a;
k=0;
for(i=2;m>1;i++) {
for(l=2; l<i;) {
l=l+1;

[Code] ......

View Replies View Related

Basic Program To Plot Motion Of A Pendulum

Oct 22, 2014

Here is the outline of what the program should do: [URL] .....

So far I've got the very basics in place, I can't really figure out ptplot despite trying to research it online. The only other thing I know is that arrays are not to be used (initially I intended on using them). Here's my code:

//The next line imports the java.io package
import java.io.*;
//Imports math language
import java.lang.Math;
//import ptolemy.plot.*;
//Sets up class
public class cp5 {
//Declares class method called 'main'.

Code] ....

View Replies View Related

Basic Stack Hanging - Program Kept Running With No Result

Nov 16, 2014

I was doing some exercises of a java tutorial website, and realized when I ran the code that they had , my program just kept running with no result, why is this? It just hangs.

package mystack;
public class MyStack {
private int maxSize;
private int[] stackArray;
private int top;
public MyStack(int s)

[Code] ....

View Replies View Related

Basic Grading Program - Output Should Be Printed With Suitable Labels

Oct 6, 2014

Write a program to request a student number and their marks in 4 subjects. The program must print the student number, total marks and average mark. All outputs should be printed with suitable labels

This is the error am getting

Scanner get = new Scanner (System.in) - got a red line

int student number, total marks, average mark - got a yellow bulb with a red exclamation mark on it.

I just dont understand where the errors is where what the system dont have ... I am using netbeans ....

View Replies View Related

How To Read Employee Thumb Impression From Biometric Instrument Using Java

Mar 13, 2014

How to read the thumb impressions by using bio-metric instrument using a java code and comparing the thumb impressions in java.

View Replies View Related

Making J2me List Generate Program

Apr 6, 2014

I have to make a program on J2Me which I don't have a clue, the question is :

-------------
"Initial display is a text box, with a command button "Generate". When the user enters the list type and clicks on the Generate button, the application asks count of elements and gets the elements and finally displays the list."
--------------

View Replies View Related

How To Put Console On JFrame Or Graphics Program Window

Sep 8, 2014

how to put a console on a JFrame or on graphics window. I thought about simply using a JtextField however I don't have access to the readline command since it appears to me that it is only found in a Console Program. So basically I was wondering how to put up a console on JFrame so I can issue commands on it and watch graphical stuff happen on the same screen(minus where the console box is of course).

View Replies View Related

Multi-User Console Chat Program

Nov 22, 2014

My task is to create multiuser console chat program. During whole day of poking around , i finally stand on such concept:

1. When running , Server part must stay into while(true) loop and create threads on each ServerSocket.accept() call, providing socket object inside thread. i.e.

while (true){
System.out.println("Waiting for client to connect");
Thread t = new Thread(new Runner(servSocket.accept(),listOfClientSockets));
System.out.println("Starting thread");
t.start();
}

2. Client side always stays within while(true) loop and waiting for user input with ScannerInstance.nextLine() method.
As soon as user prints something and hits enter, data being captured from scanner and thrown to socket output stream to the server.

My question is : if all parties (X clients and server) are actually in waiting mode (server is waiting for connections and each client is waiting for user input), who will refresh the screen for each client to draw the messages other parties sent?

At this time , each party see updates only when he hits enter and while loop does next iteration reading data from buffer and displaying on console.

View Replies View Related

Basic Java GUI Application - Array Searching

Nov 30, 2014

I am currently working on a application for a car park system. It uses GUI created by myself and holds 15 parking spaces. The user has the option to add, delete or search for a specific car. When the user adds a new car, details of the car are entered, the cars registration number (saved as a string), and the user had to check one raido button if the car is expensive, large or normal.

Once this information is entered a new instance of a vehicle will be created and the bay the car is allocated to turns green and stored in one of three arrays(expensive, normal or large). I also have a fourth array for creating the parking spaces.Each array can only hold 5 vehicles apart from the fourth which can hold all 15. When searching for a vehicle the user enters the registration of the vehicle they want to find, but I have to search through all three arrays to find it, and if it does not exist showing a message saying so.These are my three arrays

public static ParkingBay[] regularBays = new ParkingBay[5];
public static ParkingBay[] largeBays = new ParkingBay[5];
public static ParkingBay[] expensiveBays = new ParkingBay[5];

String Registration; - saves registration entered from add form
String RegistrationNumber; - saves registration number from search form

I need to search to see if RegistrationNumber is in either of the three arrays if not show a message saying otherwise

View Replies View Related

How Many Files Does It Take To Make A Very Basic Java Page

Aug 29, 2014

How many files does it take to make a very basic java page? Can it be just one file which is run off a hard drive?I want to connect to a SQL server and update records only

View Replies View Related

Console Calculator Program - How To Split Array Of Strings

Apr 22, 2015

I'm writing a command line application of a calculator in Java. I need to be able to (as per program requirements) split the array of strings (6+3) into an array of strings? How would that be done? I know you can use the split method, but I am not really sure how that wold work to perform math with them?

On a side note: for this application, how could you make the program accept a variety of different lengths of strings to perform math with them?

View Replies View Related

I/O / Streams :: Deserializing Visual Basic 6 Files In Java?

Jan 27, 2012

I have to be able to read files that have been serialized in VB. 2 things, 1 they are serialized in Binary, and I tried to look up on how to serialize/deserialize in Binary, but didn't have much support...

Also in the VB code they talk about "TYPES" which seems to be to just be a class full of stuff...

View Replies View Related

Holiday Program - Using Jansi Library To Add Color To Console Text

Dec 26, 2014

While making my holiday program and trying to use the Jansi library to add color to the console text,

I got this output:

Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: Uncompilable source code - package org.fusesource.jansi does not exist
at Main.<clinit>

View Replies View Related

Simulate Simple Calculator That Performs Basic Arithmetic Operations Of JAVA

Sep 9, 2014

How can i write a java program that simulate a simple calculator that performs the basic arithmetic operations of JAVA. (JOption Pane and Repeat control structure)

Example : Addition, Subtraction, Multiplication, Division.

The program will prompt to input two floating point numbers and a character that represents the operations presented above. In the event that the operator input is valid, prompt the user to input the operator again.

Sample Output :

First number 7
Second number 4
Menu

<+> Addition
<-> Subtraction
<*> Multiplication
</> Division

Enter Choice: * <enter>

The answer is 28.

View Replies View Related

Servlets :: How To Generate N Number Of PDF In Java

May 13, 2014

i want to generate n number of pdf here n will be some limit according to requirement so ultimately I have to generate more than 1 pdf same time with once running the code I Have some values associated with id i want to print those values with respective id's in pdf format, values can be in database or in some variable , which way i should go... i have some ideas either i can save those values in database and can make a single xml file from database of all records and then divide each node with different different pdf or directly get the values from database and generate the pdf.

View Replies View Related

Java Console SQL DB Query App

Nov 4, 2014

I seem to be having a issue with my java console app what it should do is query a SQL DB and list the user details (userid, firstname ,lastname) from the user table, and the users stocks (stockname ,stockdiscription) associated to each user from the userstocks table if I'm thinking correctly!

I'm sure it is just a logical error, but I'm not sure of the way to get the out put I'm looking for. I will add the makeDB.java file and DatabaseQuery.java file as well as the current Exception(Run Time Exception) below.

**I have added other users and stocks manually - Not just what the MakeDB.java file inserts **

Output and Exception:

Stock holdings by User
User ID User Name
Stock - Description
-------------------------------------------
admin01 Default Admin
Exception in thread "main" java.sql.SQLException: ResultSet is closed
at sun.jdbc.odbc.JdbcOdbcResultSet.checkOpen(JdbcOdbcResultSet.java:6647
)
at sun.jdbc.odbc.JdbcOdbcResultSet.next(JdbcOdbcResultSet.java:1248)
at DatabaseQuery.main(DatabaseQuery.java:45)
Press any key to continue . . .

Java Code:

MakeDB.java:
import java.sql.*;
import java.io.*;
public class MakeDB
{
public static void main(String[]args) throws Exception
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

[Code] ....

View Replies View Related

Generate A File In Java With Unix TimeStamp

Feb 5, 2015

I need to generate a file in Java with Unix TimeStamp. Want to generate an ordered list of Data entry objects for a defined period of time e.g., getData (long startTimeStamp, endTimeStamp, long resolution).

1) I would like to generate resolution with random numbers by using Random class.

2) How to take Start and end timestamps to generate a file (i.e., writing into a file).

View Replies View Related







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