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

Q.No.2. Design an abstract class GeometricObject with lineColor as data member. GeometricObject must ensure that its children implement calcArea() method.  [Marks : 03]

 

Design RectangleYourRegNo and CircleYourName Classes as children of GeometricObject class with overridden toString() method to return “Rectangle with w Width and h Height is drawn” OR “Circle with r Radius is drawn”. The attributes of Rectangle are length, width. The attribute of Circle is          radius

Hint: Area of circle=πr2 , Area of rectangle= width*length


You have the String marks="60";

You want to use marks in in the method grading(int mk) which receives the marks and the return the corresponding grade. Which processing must be doe to marks for it to work ?


Create a class called with your Reg No, as Invoice18Arid876, that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four pieces of information as instance variables a part number (type String), a part description (type String),a quantity of the item being purchased (type int) and a price per item (double).

 

Your class should have a constructor that initializes the four instance variables. Provide a set and a get method for each instance variable. In addition, provide a method named getInvoice Amount that calculates the invoice amount (i.e., multiplies the quantity by the price per item), then returns the amount as a double value. If the quantity is not positive, it should be set to 0. If the price per item is not positive, it should be set to 0.0. Write a test application named InvoiceTestYourName that demonstrates class Invoice’s capabilities.



Suppose that the input is:


38 35 71 14 -1


What is the output of the following code? Assume all variables are properly declared.

sum = console.nextInt();

num = console.nextInt();

for (j = 1; j <= 3; j++)

{

num = console.nextInt();

sum = sum + num;

}

System.out.println("Sum = " + sum);



Suppose that you have the following declaration:

int j = 0;

The output of the statement:

if ((8 > 4) || (j++ == 7))

System.out.println("j = " + j); is:

j = 0

while the output of the statement:

if ((8 > 4) | (j++ == 7))

System.out.println("j = " + j);

is:

j = 1

Explain why.


A Sports Club is an organization formed in order to help its members develop interest in certain

sports.


A Sports Club is an organization formed in order to help its members develop interest in certain

sports.


Write a class with name ArrayDemo . This class has an array which should be initialized by user as given below. write a function with name display in this class.Call this display function in main function. [4 marks]

                                              -1 4 1 6  3 8  5 10 7 12


Write a class with name ArrayDemo . This class has an array which should be initialized by user as given below. write a function with name display in this class.Call this display function in main function. [4 marks]

                                              -1 4 1 6  3 8  5 10 7 12


Write a class named Sorting with sort function in order to sort the following array as program. Call sort function in main function. [4 marks]

 

                      char[] j= {'r', 'g', 'o', 'm', 'r', 'p','a'};

             

output display as “program” 


    


LATEST TUTORIALS
APPROVED BY CLIENTS