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

Using a while loop, write a program to calculate and print the sum of a given number of squares.


Create an abstract class named Book. Include a String field for the book’s

title and a double field for the book’s price. Within the class, include a

constructor that requires the book title, and add two get methods—one

that returns the title and one that returns the price. Include an abstract

method named setPrice(). Create two child classes of Book: Fiction and

NonFiction. Each must include a setPrice() method that sets the price for

all Fiction Books to $24.99 and for all NonFiction Books to $37.99. Write a

constructor for each subclass, and include a call to setPrice() within each.

Write an application demonstrating that you can create both a Fiction and

a NonFiction Book, and display their fields. Save the files as Book.java,

Fiction.java, NonFiction.java, and UseBook.java


Create a class named Horse that contains data fields for the name, color, and birth year. Include get and set methods for these fields. Next, create a subclass named RaceHorse, which contains an additional field that holds the number of races in which the horse has competed and additional methods to get and set the new field. Write an application that demonstrates using objects of each class. Save the files as Horse.java, RaceHorse.java, and DemoHorses.java.


Write a program to print the names of students by creating a

Student class. If no name is passed while creating an object of

Student class, then the name should be "Unknown", otherwise the

name should be equal to the String value passed while creating

object of Student class.


Suppose there is a list s1->s2->s3->.........->sn-1


->sn. given to you. Write the algorithm and the pseudo code to modify this list in


such a way that it will be s1->sn

->s2->sn-1

->s3->sn-2.......



Note: algorithm should be in place without modifying the values of the nodes.

Marking Scheme: Total 10 marks ( Algorithm explanation + Pseudo-code + runtime and data

structure used)


Write a program to calculate gross and net pay of employee from

basic salary. Create employee class which consists of employee

name, emp_id, and basic salary as its data members. Use

parameterized constructor in the derived class to initialize data

members of the base class and calculate gross and net pay of the

employee in the derived class.


Gardening

We have a task to do Gardening.

Given two boolean values

isGrassTrimmerFound


and

isWaterHosePipeFound

  1. as inputs, create three JS promises using async/await and try/catch blocks. For cutting the grass,
  • resolve with "Grass Trimmed" text, if the
  • isGrassTrimmerFound
  • is true
  • reject with "Grass Trimmer Not Found" text, if the
  • isGrassTrimmerFound
  • is false
  1. For cleaning the garden,
  • resolve with "Garden Cleaned" text
  1. For watering the plants,
  • resolve with "Watered Plants" text, if the
  • isWaterHosePipeFound
  • is true
  • reject with "Water Hose Pipe Not Found" text, if the
  • isWaterHosePipeFound
  • is false

Input

  • The first line of input contains a boolean
  • isGrassTrimmerFound
  • The second line of input contains a boolean
  • isWaterHosePipeFound

Output

  • The output should be a string with the appropriate messages in separate lines

Sample Input 1

Sample Output 1Sample Input 2Sample Output 2


1.Imagine a tollbooth with a class called toll Booth. The two data items are a type unsigned int to hold the total number of cars, and a type double to hold the total amount of money collected. A constructor initializes both these to 0. A member function called payingCar ( ) increments the car total and adds 0.50 to the cash total. Another function, called nopayCar ( ), increments the car total but adds nothing to the cash total. Finally, a member function called displays the two totals. 



 How to connect Java application with Oracle and Mysql database using JDBC? Explain the complete procedure to connect the form of your question  #228424 into your database using Oracle or Mysql. [Please write the reason for writing that line at the end of each line in the form of comments (for coding).]


How to connect Java application with Oracle and Mysql database using JDBC? Explain the complete procedure to connect the form of your question #228421 into your database using Oracle or Mysql. [Please write the reason for writing that line at the end of each line in the form of comments (for coding).]


LATEST TUTORIALS
APPROVED BY CLIENTS