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

Create the Animal class, which is the abstract superclass of all animals







-Declare a protected integer attribute called legs, which records the number of legs for this animal.








-Define a protected constructor that initializes the legs attribute.








-Declare an abstract method eat.








-Declare a concrete method walk that prints out something about how the animals walks (including the number of legs).








2.Create the Spiderclass.








-The Spider class extends the Animal class.








-Define a default constructor that calls the superclass constructor to specify that all spiders have eight legs.








-Implementthe eatmethod.








-Create the Petinterface specified by the UML diagram.








-Create the Cat class that extends Animaland implements Pet.








-This class must include a Stringattribute to store the name of the pet.












Create a Java program in jdoodle that will determine if the score is Passed/Failed. (10 is the passive score out of 20)

  • Will not accept special characters.
  • will not accept blank score.
  • will not accept if it's greater than 20.
  • will not accept if it's lesser than 1.

Victor has an array of size n.He loves to play with these n numbers.each time he plays with them ,he picks up any two consecutive numbers and adds them. on adding both numbers, it costs him K*(sum of both numbers).

Find the minimum cost of adding all the numbers in the array.

i/p1:size of array

i/p2:elements of array

i/p3:value of K

o/p:return the maximum cost of adding all the numbers of the array.

Ex1:

i/p1:3

i/p2:{1,2,3}

i/p3:2

o/p:18


Design a program using Java Apache NetBeans (Console application). With the following




enum class:


public enum Day {


SUNDAY, MONDAY, TUESDAY, WEDNESDAY,


THURSDAY, FRIDAY, SATURDAY


}


Create a second class called enumDayMood with a void method call telDayMood ().


This method contain a switch case as follows:


switch (day) {


case MONDAY:


JOptionPane.showMessageDialog (frame, "Mondays are bad.");


break;


case FRIDAY:


JOptionPane.showMessageDialog (frame, "Fridays are better.");


break;


case SATURDAY: case SUNDAY:


JOptionPane.showMessageDialog (frame, "Weekends are best.");


break;


default:


JOptionPane.showMessageDialog (frame, “Midweek days are so-so.");


break;


}


Create a method that will ask the user to enter a day of a week and the program should tell the mood of the day. If the user enter a wrong value the program should exit with 0.

1. Create four (4) Java classes. Name them RunEmployee, Employee, FullTimeEmployee, PartTimeEmployee. The RunEmployee class shall contain the main method and will be used to execute the program.



2. Write a simple payroll program that will display employee’s information. Refer to the UML Class Diagram for the names of the variable and method. This should be the sequence of the program upon execution:



a. Ask the user to input the name of the employee.



b. Prompt the user to select between full time and part time by pressing either F (full time) or P (part time).



c. If F is pressed, ask the user to type his monthly salary. Then, display his name and monthly salary.




Write a program that will determine the best second year student.

write a class definition for Student class that contains four private data members


you want to buy a particular stock at its lowest price and sell it later at its highest price,since the stock market is unpredictable,you steal the price plans of a company for this stock for the next N days.

Find the best price you can get to buy this stock to achieve maximum profit.

Note:The initial price of the stock is 0.

Input1:Nnumber of days.

Input2:Array representing changing stock price for the day.

Output: Your function must return the best price to buy the stock at.

Example:

Input1:5

Input2:{-39957,-17136,35466,21820,-26711}

Output:-57093


(Inserting Elements in a Linked List in Sorted Order) Write a program that inserts 25 random integers from 0 to 100 in order into a Linked List object. The program should sort the elements, then calculate the sum of the elements and the floating-point average of the elements


Write a class named CharArray that has the following field:

1. myCharArray. The myCharArray field is a character array.

In addition, the class should have the following constructor and other methods.

• Constructor: The constructor should accept the char array as arguments

• swapFirstAndLast: The swapFirstAndLast method should swap the first element with the

last element in the array.

• DisplayArray: The DisplayArray method should display the characters in the array.

• DispalyString: The DispalyString method should display the char elements as a string word

in the array.

1


Rob is fond of collecting coins but unfortunately,sometimes he has to sell a coin to get other coins.he puts all his coins one over the other in a column.

(0,i):Add coin with value i to the collection.

(1,0):sell a coin.

Selling a coin:For selling a coin ,he picks up the top coin in the coloumn if he constraint A is satisfied.Constraint A:Rob can only sell the coin if the coin collection value is more than Y.

Upon removal ,the coin collection value goes to the previous value.Initially,with 0 coins ,coin collection value is 0.

Adding a Coin:on adding a coin of value i to the collection the coin collection value increments via the following prodcedure.

If the coin collection had>=X value then current total value is X+i else X+2*i.

Rob needs to find and return the final value of coin collection after Q operations.

Note:Initially,the value X is 0 and not X.

Ex1:

i/p1:10(deciding increment)

i/p2:0(selling coins)

i/p3:1(no of operations)

i/p4:{{0,5}}

o/p:10



LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS