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 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.
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 neat and clean Java Code with Classes, Obejcts, Constructors and Overloaded Methods
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
Given a set of N elements that contain exactly X distinct elements (while the rest are repetitions), the redundancy ratio is defined as the ratio N/X.

You are supposed to write a program to input a set of integers, and keep track of the redundancy ratio. Once the redundancy ratio reaches or exceeds a specific value r, the program terminates and prints this ratio with a message indicating that your numbers have “many repetitions”. If you want to force the program to terminate before the redundancy ratio reaches r, you can input -1 as your input integer. In this case, the program prints the current ratio with a message indicating that your numbers have “only few repetitions”.
Input format:
First line contains the redundancy ratio r as a real number greater than 1.
Next lines contain integers one per line.
Output format:
Print the required answer. Sample input 1 1.5 1 4 2 5 2 2 Sample output 1 ratio=6/4=1.5 many repetitions
LATEST TUTORIALS
APPROVED BY CLIENTS