Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

It says "Reached end of file when parsing." How do I fix that? Here is my code.import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class Frame extends JFrame{

private JButton login;
private JTextField user;
private JPasswordField pass;

public Frame(){
super("Login");
setLayout(new FlowLayout());

user = new JTextField(15);
add(user);
pass = new JPasswordField(15);
add(pass);
login = new JButton("Login");
add(login);
login.addActionListener(new ButtonListener());
}

public class ButtonListener implements ActionListener{
public void actionPerformed(ActionEvent event) {
if(user.getText().trim().length() == 0 || pass.getText.equals().length() == 0){
JOptionPane.showMessageDialog(null, "Please fill out both of the text-boxes");
How do I make is so that I am able to, not only enter and save data, but also edit it. Here is my code.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Scanner;

public class Catalog {

static String fileName = null;
static Hospital lib = new Hospital();
static Scanner in = new Scanner(System.in);
static Boolean running = true;

public static void main(String[] args) {
while (running) {
System.out.println("\nEnter 0 to load a hospital."
+ "\nEnter 1 to save and quit"
+ "\nEnter 2 for a list of all patients in the hospital"
+ "\nEnter 3 to add a patient to the hospital");

int answer = in.nextInt();
switch (answer) {
case 0:
System.out.println("Enter the file name to load");
loadScript(in.next());
break;

case 1:
saveAndQuit();
break;
case 2:
An electricity board charges the following rates to domestic users:- For the first 100 units – 40p/unit For the next 200 units – 50p/unit Beyond 300 units – 60p/unit. Write a program to read the names of users and number of units consumed and print out the charges with names. Use the concepts of classes.
5. An electricity board charges the following rates to domestic users:- For the first 100 units – 40p/unit For the next 200 units – 50p/unit Beyond 300 units – 60p/unit.
this is my assignment: write a method called remove that accepts one ArrayList<String> parameter and one char parameter.go through the ArrayList and remove any string that begins with the character in the second parameter . the method does not need to return any values. i have posted my solution down below but for some reason there is an error.

public class test
{
public void remove(ArrayList() arInput, char c)
{
for (int i = 0; i <= arInput.length; i++)
{
ArrayList() newArray = new ArrayList();
if (c != arInput[i].substring(0,1))
{
newArray.put[arInput[i]];
}
}
System.out.println("new array is: " + newArray);
}
}
Write a program which will get the personal names from the user and store them in an array list called “personalNames”. If there is any other character besides “a-z” or “A-Z” in a record, those should be flagged as ill-defined data. Because of the stated reasons above, instead of trying to fix the error in personal names, we want to remove this ill-defined data from the original array list and move it to another array list called “errorProneNames”. In other words, error involving records should be saved in a separate array. At the end your solution should print out the “personalNames” and “errorProneNames” array list separately
How to populate an empty two-dimensional array with random numbers from 0-5?
how to use default combobox inside table model listener to affect two cell column
You have a block of platinum that can be exchanged in your bank either for cash
or for smaller blocks of platinum. If you exchange a block of m grams, you get
three blocks of weight m/2, m/3 and m/4 grams each. You don't get any fractional
part, as the division process rounds down the value. If you exchange the block of
platinum for cash, you get m units of currency. You can do any number of
exchanges for smaller blocks or currency.
Given the value of a block in grams as input, write a program that would print the
largest possible currency value that you can receive as the output. Assume that
the maximum value of a block that can be given as an input is 1,000,000,000
grams and the minimum value is 2 grams.
1. Write a JAVA program that will input Employee Name, Rate per hour, No. of hours worked and will compute the daily wage of an employee. If the number of hours worked exceeds eight hours add 30% to each excess hours as overtime rate.
Formula: Daily Wage = Rate per hour * No. of hours worked + OT pay
LATEST TUTORIALS
APPROVED BY CLIENTS