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

The abstract Fruit.java class contains some methods and variables that it takes care of, and one method called getCost() that every inheriting subclass must Override given that each fruit object will calculate the cost differently.

1-Apple: The apple class inherits from Fruit. It accepts also the number of apples to add in the constructor. The price returned is per dozen! You must use the price already given to you in file Consts.java. The getCost() method must return the correct price for all the applies. For example, if the price per dozen is 24.0, and you added 3 apples, then the total cost of this class should return 6.0 QR.
4-OrangeLime: This class inherits from Lemon class that you just created above. This “fruit” is really a special addition of the fruit shop where they use some lemons to create special juice mixes. The constructor of this class will take the price per lemon (same as above for the Lemon class), how many juices, and the labor cost. Each juice will have a predefined number of lemons in it. Use the LEMONS_IN_A_JUICE constant in the Consts.java file to get that number. The getCost() method will return the cost of all lemons in the juices order plus a labor cost that was given in the constructor. The labor cost is for all the juices and not for each individual juice. So if there is an order of 4 juices, each juice takes 6 lemons, and each lemon costs 0.4 QR. The labor cost is 5 QR, then the cost is (4 * 6 * 0.4) + 5 QR which must be returned by the getCost() function.
2-We must calculate the banana price by supplying both how many KGs of bananas we are adding to the cart, and the price per KG in the constructor. The getCost() method will return the total cost based on these two values.
3- Lemon: This class also inherits from Fruit. You must supply a price per lemon and how many lemons we are adding through the constructor. The getCost() method will just return the cost of all the lemons.
The abstract Fruit.java class contains some methods and variables that it takes care of, and one method called getCost() that every inheriting subclass must Override given that each fruit object will calculate the cost differently.

1-Apple: The apple class inherits from Fruit. It accepts also the number of apples to add in the constructor. The price returned is per dozen! You must use the price already given to you in file Consts.java. The getCost() method must return the correct price for all the applies. For example, if the price per dozen is 24.0, and you added 3 apples, then the total cost of this class should return 6.0 QR.
The user enters the following code. What will be the value of
total after the code is executed?
val1 = 4;
val3 = 20;
total = sum(val1,val3);
I would like to know if you can help me to write JAVA code for task which sounds like this " Multiplex circular buffer as a transmission channel
between one thread - the sender, and N (parameter) threads receivers.
Each report is considered as read when report is read by ALL threads
- receivers. The thread that performs the reading operation refers to its number in the interval
0..n -1." Will be very thankful
Question: Create the following class in Java as specified in the UML diagram below:

SimpleCalc

+ SimpleCalc()
+ add(int, int):int
+ subtract (int, int):int
+ multiply (int, int): int
+ divide (int, int): double

• Create an application program (useCalc.java) with a main method. Within this method instantiate/create an object of SimpleCalc and test all four of its methods. Run the useCalc.java class.
public boolean rearrange()

You need to write the rearrange method that rearranges the initial stack and also determines if it is feasible. It should return true if a rearrangement is successful, false otherwise.
Please see the StackRearranger.java file for more details.
A university posts its employees’ salaries at
http://cs.armstrong.edu/liang/data/Salary.txt. Each line in the file consists of a
faculty member’s first name, last name, rank, and salary (see Liang Book:
Programming Exercise 12.24). Write a program to display the total salary for assistant
professors, associate professors, full professors, and all faculty, respectively, and
display the average salary for assistant professors, associate professors, full professors,
and all faculty, respectively.
Can you help me code this please?

Develop and run a Complete Java applet to prompt user to input for radius of a cylinder and call methods CylinderVolume and CylinderSurfaceArea to calculate and display the area and perimeter of that rectangle using the assignment. Declare all variables as double data type and display the output to two digits after decimal point.

volume = 3.14 * radius^2 * height
surfacearea = 2 * 3.14 * radius (height + radius)

With this user interface:

----------------------------------------------------------------------------------------------------------------------

Enter Radius [Input Text Field]
Enter the height of the Cylinder [Input Text Field]

(Button to calculate volume) (Button to calculate surface area)

The Volume of Cylinder is [Output Text Field]
The Surface Area of a Cylinder is [Output Text Field]

----------------------------------------------------------------------------------------------------------------------
LATEST TUTORIALS
APPROVED BY CLIENTS