Java | JSP | JSF Answers

Questions answered by Experts: 3 611

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

How do I choose and edit a specific class that is in a java library using the str.replace method?
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.
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);
}
}
How to populate an empty two-dimensional array with random numbers from 0-5?
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
how do i make a jcombobox affect two cell in a row of jtable in a java program
hello
can you help me please !
Write a java program to execute the following operations:
1- Create two arrays as follows:
String season[]={"Summer","Winter","Autumn","Spring"}

Floattemp[]={26.8f,44.6f,12.9f,10.4f,50.1f,45.0f,33.7f,39.0f};

2- By using (for loop) and ( if statement) check each temperature in temp[] array as the following condition:

 If season=Summer and temp>40 print the following message:
Ex: " 45.0 is the temperature in summer season"

 If season=Winter and temp<20 print the following message:
Ex: " 12.9 is the temperature in winter season"

 If season=Autumn and temp>20 and temp<30 print the following message:
Ex: " 26.8 is the temperature in Autumn season"

 If season=Spring and temp>30 and temp<40 print the following message:
Ex: " 33.7 is the temperature in spring season"
1.What is method overloading?

2. What is the purpose of a constructor?

3. How do you call a method of one class from a method of another class?

4.(a.) Explain how Java programs are compiled and run, and how this differs from the way most other programs are compiled and run.

(b.) Explain with the aid of a diagram the advantages of object oriented approach over structured approach to modular design.

(c.) Write a method that (a) returns the maximum value in an array (b) a method that searches an array and returns the position of an item within the array or -999 if the value is not present in the array.

(i). Write a short menu driven program that makes use of the above methods(array method)
LATEST TUTORIALS
APPROVED BY CLIENTS