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

Given the number of people attending a pizza party, output the number of needed pizzas and total cost. For the calculation, assume that people eat 2 slices on average and each pizza has 12 slices and costs $14.95.

Output each floating-point value with two digits after the decimal point, which can be achieved as follows:

System.out.printf("Cost: $%.2f\n", cost)


Write a program to read the content of any of the below website and all its sub pages and perform following actions:




Parse all the pages and sub pages of News, Sports and Business section




Extract the content, Image and Links




Dump the Content, Image and Links into the respective mongo collections





Websites




https://timesofindia.indiatimes.com/

Simulate or explain the code


public Act4B_Grp3_DAT2A(int size) {


A = new int[size];

N = 0;

}


public void insertItem(int item) {

if (N < A.length) {

int insertLocation = findLocationInsert(item);

for (int i = N - 1; i >= insertLocation; i--) {

A[i + 1] = A[i];

}

A[insertLocation] = item;

N++;

}


}


private int findLocationInsert(int item) {

if (N < A.length){

for (int i = 0; i < N; i++) {

if (A[i] > item) {

return i;

}

else {

System.out.print("This is full!");

}

}

return N;

}

return N;

}


public void deleteItem(int item) {

int deleteLocation = findLocationDelete(item);

if (deleteLocation != -1) {

for (int i = deleteLocation + 1; i < N; i++) {

A[i - 1] = A[i];

}

N--;

}

}


private int findLocationDelete(int item) {

for (int i = 0; i < N; i++) {

if (A[i] == item) {

return i;

}

else {

System.out.print("Element not found!");

}

return -1;

}

return -1;

}


Please explain this code or simulate this.




public SortedLinearArray(int size) {



array = new int[size];



currentSize = 0;



}




public void insertItem(int item) {



if (currentSize < array.length) {



int insertLocation = findLocationInsert(item);



for (int i = currentSize - 1; i >= insertLocation; i--) {



array[i + 1] = array[i];



}



array[insertLocation] = item;



currentSize++;



}



}




private int findLocationInsert(int item) {



for (int i = 0; i < currentSize; i++) {



if (array[i] > item) {



return i;



}



}



return currentSize;



}




public void deleteItem(int item) {



int deleteLocation = findLocationDelete(item);



if (deleteLocation != -1) {



for (int i = deleteLocation + 1; i < currentSize; i++) {



array[i - 1] = array[i];



}



currentSize--;



}



}




private int findLocationDelete(int item) {



for (int i = 0; i < currentSize; i++) {



if (array[i] == item) {



return i;



}



}



return -1;



}




Create frame to display two buttons named "Click Me-1" and "Click Me-2". If you click on the "Click Me-1" button then a JOptionPane Message dialog box should display message " you have clicked Click Me-1 button" and 


If you click on the "Click Me-2" button then a JOptionPane Message dialog box should display message " you have clicked Click Me-2 button". Clicking on the cross button in the frame should exit the program.


1. Write a program to read the content of any of the below website and all its sub pages and perform following actions:



1. Parse all the pages and sub pages of



News, Sports and Business section



2. Extract the content, Image and Links



3. Dump the Content, Image and Links into the respective mongo collections





class MyClassCircle {

private double radius;

MyClassCircle(double radius) {

this.radius = radius;

}

public double getArea() {

return Math.PI * radius * radius;

}

}


class GetAreaDemo {

public static void main(String [] args) {

MyClassCircle circle = new MyClassCircle(5.6);

System.out.println("Area of the circle with radius 5.6 equal to " + cicle.getArea());

}

}


What is the use/uses of variable, double radius and MyClassCircle in the program?


Write a Java program to create a new string taking first and last characters from two given strings. If the length of either string is 0 use "#" for missing character.


You are required to design a Car class which has following attributes

        String brand;

        Double price;

        Double quantity;

        String Model;

        Boolean available;

1.     Provide default & Parameterized constructors.

2.     Provide getters & setters for data members.

3.     Provide a toString() method to print values.

 

 Now create an ArrayList of Cars in a class ShowRoom having name and address as attributes as well, Provide appropriate methods, store values in array List (take values form user).

Provide a buy method which will ask user to buy a Car by providing its name, check that it is present or not then ask for quantity and create bill for user.

After that you have to print the following

1.     Add Car

2.     Delete Car

3.     Buy a Car.

4.     Display All cars also display

·        Car of brand “Audi”;

·        Car with name starting with ‘L’.

·        Car name end with ‘n’.

·        Display only last three and first three letters of Showroom name.


You are required to design a Car class which has following attributes

        String brand;

        Double price;

        Double quantity;

        String Model;

        Boolean available;

1.     Provide default & Parameterized constructors.

2.     Provide getters & setters for data members.

3.     Provide a toString() method to print values.

 

 Now create an ArrayList of Cars in a class ShowRoom having name and address as attributes as well, Provide appropriate methods, store values in array List (take values form user).

Provide a buy method which will ask user to buy a Car by providing its name, check that it is present or not then ask for quantity and create bill for user.

After that you have to print the following

1.     Add Car

2.     Delete Car

3.     Buy a Car.

4.     Display All cars also display

·      Car of brand “Audi”;

·      Car with name starting with ‘L’.

·      Car name end with ‘n’.

·      Display only last three and first three letters of Showroom name.


LATEST TUTORIALS
APPROVED BY CLIENTS