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

Accept names and marks of 10 students from user

. Ensure that valid data is entered. If user enters an invalid data then appropriate message should be displayed, e.g. “Name cannot be a number” or “Marks must be an integer value”

. Display this data in descending order according to the marks such that name of the student having maximum marks should be displayed at the top and the name of the student having minimum marks should be displayed at the bottom
Design an abstract class GeometricObject with lineColor as data member. GeometricObject must ensure that its children implement calcArea() method. Design Rectangle and Circle 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 attribute of Rectangle are length and width

- The attribute of Circle is radius


*Hint:

Area of Circle= πr2

Area of Rectangle=w*l
Write Java Code to input a complete paragraph, as an input. Further, read a single character/letter. Finally, you are required to [Marks = 02]

(a) - Count the number of Words in the paragraph starts with the letter taken as input from the user.

(b)- Display the total number of words in the paragraph

Implement all this scenario using OOP Concepts of Java. Your code should also take care of the exceptions that can occur while dealing with Strings.
Java program to

a. Accept names and marks of 10 students from user

b. Ensure that valid data is entered. If user enters an invalid data then appropriate message should be displayed, e.g. “Name cannot be a number” or “Marks must be an integer value”

c. Display this data in descending order according to the marks such that name of the student having maximum marks should be displayed at the top and the name of the student having minimum marks should be displayed at the bottom.
Design an abstract class GeometricObject with lineColor as data member. GeometricObject must ensure that its children implement calcArea() method. Design Rectangle and Circle 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 attribute of Rectangle are length and width

- The attribute of Circle is radius


*Hint:

Area of Circle= πr2

Area of Rectangle=w*l
Write Java Code to input a complete paragraph, as an input. Further, read a single character/letter. Finally, you are required to

(a) - Count the number of Words in the paragraph starts with the letter taken as input from the user.

(b)- Display the total number of words in the paragraph

Implement all this scenario using OOP Concepts of Java. Your code should also take care of the exceptions that can occur while dealing with Strings.
Create a class named 'Member' having the following members:

Data members

1 – Name

2 – Age 3 - Phone number

4 – City 5 – Salary

,Two classes 'Employee' and 'Manager' inherits the 'Member' class. The 'Employee' and 'Manager' classes have data members 'specialization' and 'department' respectively. Now,

(a)- Assign name, age, phone number, city and salary to an employee and a manager by making an object of both of these classes and print the same.

(b)- Add a method to the above class, searchBySpecialization(), which inputs the Specialization from user and print all the Employees with the entered specialization

(c)- Add another method to the above class searchBySalary(), which inputs the two Values of the Salary Minimum and Maximum and then show all the Employees with Salary in the entered range of the Salary and with Age <50.
Write Java program to

a. Accept names and marks of 10 students from user

b. Ensure that valid data is entered. If user enters an invalid data then appropriate message should be displayed, e.g. “Name cannot be a number” or “Marks must be an integer value”

c. Display this data in descending order according to the marks such that name of the student having maximum marks should be displayed at the top and the name of the student having minimum marks should be displayed at the bottom.
write a program in Java code that assigns a value entered by the user to a variable. The program then increases the value of the variable by 10 and outputs the result. Don’t forget to include the comments at the top of your program.



//***********************************************

// ASSIGNMENT #: 2

// PROBLEM #: 1

// PROGRAM-NAME: AddTen

//**********************************************

class AddTen {

public static void main(String[] args){

//Declare variables as integers, initialize variables with values

int myNumber = 5;

int myAnswer = 0;

//Do the calculation

myAnswer = myNumber + 10
The following class Pizza has incomplete codes. Write setter and getter methods for all instance variable of the class, create a parameterized constructor of this class, use isLargePizza() method, and toString() method.



public class Pizza {



String name;

double diameter;



//constructor

void Pizza()

{

//Missing Lines

}



public String isLargePizza()

{

// missing lines

}


@Override

public String toString() {

// missing lines

return super.toString();

}



Hint: When the size of the pizza is greater than 20cm, then it must be considered as large pizza. The islargePizza() method must return boolean value indicating whether the pizza is large or not.

Also, correct the given code where necessary.
LATEST TUTORIALS
APPROVED BY CLIENTS