Java | JSP | JSF Answers

Questions answered by Experts: 3 611

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

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
.
.
.




4. The Big One

by CodeChum Admin

Remember that time when we've tried identifying the largest digit among the given integer? Well, let's take it to the next level, and figure out the same thing on arrays/lists!


Let's do this one more time!


Instructions:

  1. Create a variable that accepts a positive integer.
  2. Create an empty list. Then, using loops, add random integer values into the list one by one. The number of values to be stored is dependent on the inputted positive integer given in the first instruction.
  3. Print out the largest integer among all the elements on the list, by any means necessary.

Input

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

The next lines contains an integer on each.

5
5
34
3
23
10

Output

A line containing an integer.

34





A company dealing with marketing wants to manage the data of its employees. Each employee has a full name, unique employee number (2019000 to 2019999) and the number of hours he worked and her hourly wage (price).




(Using Encapsulation)


Create a class named 'Student' with 2 instance variables (both set as private)

 The 2 variables are: String variable 'name' and integer variable 'roll_no'.

 Create a get and set Method for each variable.

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

 Create an object of the class Student

 Allow the user to enter a value for the name and roll_no and accept the values by using

the set Method of each variable

 Display the content of the object by using the get Method of each variable


LATEST TUTORIALS
APPROVED BY CLIENTS