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

Give a definition of the following:

- Class method
- Instance method
- Class variable
- Instance variable
I created an object called 'saving's and I want to use it to combine & display information I have in 3 different toString() methods that are also in 3 different classes. How do I do this? I have tried putting super.toString(); at the end of each toString method and also extended the classes, but it will only print out one of the toString methods when I either do savings.toString(); or System.out.println(savings);
Class "Savings"..

int id, String name, double balance, double interestRate

Add a constructor of Savings that receives four parameters: id, name, balance, interest rate. Validate that interest rate is greater than zero, and add set & get methods.

I know how to do most of the above, but how do I validate that the interest rate is greater than 0? Can you give a few random examples of validating variables? Does this happen in the set/get methods?
1- Create class called Account that has id(int), name (String), balance (double).
2- Add parametrized constructor, setter, getter methods. Validate that balance is always positive.
3- Add method toString that returns account information as a string.
Declares and create an array of 5 instances of Vehicle, two of which should be Dumpers, two of which should be Excavators and the other should be a Telehandler.

Dumper, Excavator and Telehandler are subclasses of Vehicle.
Write a java program that will do the following. Use classes and methods as needed.

1. Prompt the user to input five integers.
2. Put the integers into an array named UserNums
3. Display the sum of the numbers and the average.
4. Write the numbers out to a file named UserNums.txt. Use a relative path so the file will be saved in your project folder.
Create an application that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Depending on whether the student's grade point average is at least 2.0, output each record either to a file of students in good standing or those on academic probation. Save the program as StudentStanding.java.
You must also override toString() method and return a user-friendly receipt of all the items in the basket in this cashier. Once you run the TestSystem.java file that is already supplied, you must see something similar to the following:

Number of items is: 4
Total cost is: 157.69
Total tax is: 3.94
Eat Healthy Fruit Shop
---------------------
12 @ 45.00 /dz
Gala Apples 45.00
2.30 kg @ 4.30 /kg
African bananas 9.89
23 @ 3.20 /pc
Qatari Lemons 73.60
1 @ 19.20 /cp
+ 10.00 Labor
Lemon mix juice 29.20
Tax: 3.94
Total cost: 161.63
Eat Healthy Fruit Shop
---------------------
23.00 kg @ 33.20 /kg
Thailand Bananas 763.60
4 @ 19.20 /cp
+ 10.00 Labor
Juice Mix 86.80
Tax: 21.26
Total cost: 871.66
Explain why the array implementation of a stack does not require elements to be shifted but the (non-circular) array implementation of a queue does.
Assume you have a queue called Q with the following contents, and trace the following operations:

(front) (back)

4 8 2 3 1


System.out.println(Q.first()); //a) What is printed?

Integer Y = Q.dequeue();

System.out.println(Q.first()); //b) What is printed?

Q.enqueue(new Integer (5));

System.out.println(Q.dequeue()); //c) What is printed?

System.out.println(Q.first()); //d) What is printed?

//e) What are final the contents of the queue? (Indicate front and back.)
LATEST TUTORIALS
APPROVED BY CLIENTS