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

Design an application that stores different types of products available at a local IT store and the corresponding product price. The product details must be stored in parallel arrays. Use the following data to populate the three (3) parrallel arrays in a loadArrau ()method.


Create a SearchArray () method and write the code to enable the user to search for a specific type of product and if the product ID is listed in the array, show the product details. If the product ID that the user searched for does not exist in the array, show a message to indicate that this product is not available.


Prompt the user to enter numbers 1,2 or any other key to exit the application.


The product ID , product name and the product price must be displayed in a message box if a valid product ID is entered by the user.


Implement user friendliness into the application by prompting the user if they would like to search for more products.



(Parking Charges)A parking garagecharges a $2.00 minimum fee to park for up to three hours.The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hourperiod is $10.00. Assume that no car parks for longer than 24 hours at a time. Write an application that calculates and displays the parking charges for each customer who parked in the garage yesterday. You should enter the hours parked for each customer. The program should display the charge for the current customer and should calculate and display the running total of yesterday’s receipts. It should use the method calculateCharges to determine the charge for each customer.





Inventory Class Design an Inventory class that can hold information and calculate data for items in a retail store’s inventory. itemNumber, quantity, cost and totalCost (calculated as quantity times cost). Constructor Accepts an item’s number, cost, and quantity as arguments. The function should copy these values to the appropriate member variables and then call the setTotalCost function. SetItemNumber Accepts an integer argument that is copied to the itemNumber member variable. setQuantity Accepts an integer argument that is copied to the quantity member variable. setCost Accepts a double argument that is copied to the cost member variable. setTotalCost Calculates the total inventory cost for the item ( quantity times cost) and stores the result in totalCost.

getItemNumber Returns the value in itemNumber.

getQuantity Returns the value in quantity.

getCost Returns the value in cost.

getTotalCost Returns the value in totalCost.


Demonstrate the class in a driver program. 


required to store and analyze data about 6 car manufacturer's sales data in all the 12 months of a year. Demonstrate how you would store the data in a two dimensional matrix and do the following






1. Write a function to Find for a given car manufacturer, the month in which, maximum no. of cars are sold.






2 Write a function to Find the average number of cars sold for each car manufacturer 3. Write a function to Find the total number of cars sold for each car manufacturer 4. Write a function to find standard deviation for a given car manufacturer

Using Overloading Constructor


Write a class named ‘Rectangle’ with 2 instance variables:

 Variables: length and width (both type double)

 Also create a method that will compute the area of a rectangle

 The class should have 3 constructors:

i. No parameter – values of both length and width are assigned zero

ii. 1 parameter – both the length and width will be assigned with same number

iii. 2 parameters – 2 numbers are assigned as length and width respectively


Also create a class with Main Method, where you will:

 Create 3 objects of the class Rectangle:

 one with no parameters

 one with 1 parameter

 another one with 2 parameters

 Allow the user to enter the value for the objects that requires parameter(s)

 Print the area of the Rectangle for each object.


write a program thats prompts the user to enter a person's date of birth in numeric form such as 8-27-1980. the program then outputs the date of birth in the form: august 27, 1980. Your program then outputs the date of birth in the form: august 27, 1980. Your program must contain to classes: invalidDayException and invalidMonthExcep. if users enter an invalid value for a day, then the program should throw and catch and InvalidDayExcept object. similar conventions for the values of month and year. (noted that your program must handle a leap year)




Search and Rescue


Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.

Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".


Start coding now!


Input

The first line contains the size of the array/list.

The next lines contain the integers.

The last line contains an integer to be searched.

5
3
21
2
5
23
28

Output

A line containing a string.

Wrong

To be able to do this, you should create a class for a point (that has an x-coordinate and a y-coordinate). Also, create another class called Rectangle. The Rectangle should have 2 points, the top left and the bottom right. Implement the following methods for the Rectangle:

  • display() - draws the rectangle on the console based on the sample
  • area() - computes and returns the area of a given rectangle
  • perimeter() - computes and returns the perimeter of a given rectangle
  • centerPoint() - computes and returns the center point of a given rectangle
  • isSquare() - checks whether a given rectangle is a square or not. 

Input

A pair of numbers representing the points for the rectangle (x and y).

5 8

Output

The first few lines contain the drawn rectangle. After one empty line, the next line prints either "RECTANGLE" or "SQUARE".

#·#·#·#·#·#
#·········#
#·········#
#·········#
#·········#
#·········#
#·········#
#·········#
#·#·#·#·#·#

RECTANGLE
AREA:·40
PERIMETER:·26
CENTER·POINT:·(2.50,4.00)







2. Search and Rescue

by CodeChum Admin

Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.

Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".


Start coding now!

Input

The first line contains the size of the array/list.

The next lines contain the integers.

The last line contains an integer to be searched.

5
3
21
2
5
23
2

Output

A line containing a string.

Present

Today, we shall compute for the squares of all the numbers.


There's already a predefined array/list containing 100 integer values. Loop through each values, compute their squares, and display them.


public class Main {


    public static void main(String[] args) {

        int[] array = {

            2, 3, 5, 100, 7, 3, 5, 3, 1, 4,

            76, 77, 78, 79, 80, 54, 68, 61, 34, 33,

            44, 49, 100, 5, 2, 87, 34, 33, 2, 1,

            4, 5, 8, 2, 1, 8, 5, 3, 2, 1,

            88, 22, 23, 33, 48, 44, 46, 48, 50, 52,

            45, 47, 49, 51, 53, 1, 1, 1, 1, 1,

            1, 2, 3, 4, 5, 6, 7, 8, 9, 10,

            20, 19, 18, 17, 16, 15, 14, 13, 12, 11,

            11, 22, 33, 44, 55, 66, 77, 88, 99, 100,

            1000, 2001, 3000, 4001, 5000, 6001, 7000, 8001, 9000, 10001

        };

        for (int i = 0; )

    }

}


Output

Multiple lines containing an integer.

4
9
25
10000
49
9
25
9
1
16
.
.
.




LATEST TUTORIALS
APPROVED BY CLIENTS