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

How do we provide security to RMI classes? Write a program to implement Simple Student database application using RMI. Remote client consist of GUI for performing different database operations (For ex. Insert, delete, update) and retrieving data through RMI.


Regular service: $10.00 plus first 50 min. are free. Charges for over 50 min. are $0.20 per minPrem. service: $25.00 plus: calls made from 6:00 a.m. to 6:00 p.m., the first 75 min. are free; charges for over 75 minutes are $0.10 per mincalls made from 6:00 p.m. to 6:00 a.m., the first 100 minutes are free; charges for over 100 minutes are $0.05 per minprogram should prompt the user to enter an account num, a service code (type char), and the number of minutes the service was used. A service code of r or R means regular service; a service code of p means prem service. Treat any other character as an error. Your program should output the account number, type of service, number of min. the telephone service was used, and the amount due from the user. For the premium service, the customer may be using the service during the day and the night., to calculate the bill, you must ask the user to input the number of min the service was used during the day and the number of minutes the service was used during the night.


  1. The number of lines that can be printed on a paper depends on the paper size, the point size of each character in a line, whether lines are doublespaced or single-spaced, the top and bottom margin, and the left and right margins of the paper. Assume that all characters are of the same point size, and all lines are either single-spaced or double-spaced. Note that 1 inch ¼ 72 points. Moreover, assume that the lines are printed along the width of the paper. For example, if the length of the paper is 11 inches and the width is 8.5 inches, then the maximum length of a line is 8.5 inches. 


Write a program that calculates the number of characters in a line and the number of lines that can be printed on a paper based on the following input from the user: 

a. The length and width, in inches, of the paper. 

b. The top, bottom, left, and right margins. 

c. The point size of a line. 

d. If the lines are double-spaced, then double the point size of each character.





COVID-19 has triggered panic buying from Ghanaians with the expectation
that there will be declaration of lockdown after the closure of school across the
country. Retailer are increasing the prices of their goods on the shelf based on
the time it stays on the shelf. The management of “Brutus Stores” have decided on this price policy. The price of any item which is expected to sell within a
week should be increased by 20%. However, if an item stays on the shelf after a week but less than or equal to two weeks the price should be increase by 15%. The price of any other item that stays on the shelf for more than two weeks should be increase by 2%. As a programmer you have been consulted to
develop a program that will:

a. Request for item name, current price in GHc, expected duration on shelf
b. Compute the retail price of the item
c. Display the results
d. Explain your results

Suppose that overSpeed and fine are double variables. Assign the value to fine as follows: If  0 < overSpeed <= 5, the value assigned to fine is $20.00; if 5 < overSpeed <= 10, the  value assigned to fine is $75.00; if 10 < overSpeed <= 15, the value assigned to fine is  $150.00; if overSpeed > 15, the value assigned to fine is $150.00 plus $20.00 per mile over  15.

There is a binary tree given to you. In which each of the node represents the student in the class.

You are playing a game in which you need to team up with one of student in class. Team can be

formed in such a way that in a team both of the students can’t have same parent in tree and should

be at the same level in binary tree.


Input: we have given you some pair of students you need to find that is the team valid or not.

Output: ‘Yes’ if the team is valid or ‘No’ if the team is invalid.

(a) Optimal solution of O(n) for checking the team validity.

(b) How many tree traversal is required for the solution of the above problem.

Marking Scheme: Total 15 marks-> 10 for part (a)( Algorithm explanation + Pseudo-code +

runtime and data structure used)+ 5 for part (b)(explanation is required)


Suppose there is a list s1->s2->s3->.........->sn-1


->sn. given to you. You need to modify this list in


such a way that it will be s1->sn

->s2->sn-1

->s3->sn-2.......


Note: algorithm should be inplace without modifying the values of the nodes.

Marking Scheme: Total 10 marks ( Algorithm explanation + Pseudo-code + runtime and data

structure used)


1: In a N-ary land, people really like the number ‘n’. You are their chief algorithms

expert and given the task of designing an n-ary heap for these people. An n-ary heap is

like a binary heap, but non-leaf nodes have ‘n’ children instead of

2 children. You have to design an n-ary heap and answer the following

a) How can we represent an n-ary heap in an array?

b) Let’s say we have an n-ary heap which contains ‘d’ number of elements in total. Give the

height of this heap in terms of ‘n’ and ‘d’.

c) Give an efficient implementation of EXTRACT-MAX and INSERT in an n-ary Max heap.

Analyse the running times of both of the functions in terms of ‘d’ (total size) and n.

d) Give an efficient implementation of DECREASE-KEY(A, i, k) which will give an error if k

> A[i], but otherwise sets A[i] = k and then updates the n-ary max-heap structure

appropriately. Analyse its running time in terms of ‘d’ (size) and n.


Dumbledore's Luncheon

Dumbledore is hosting a luncheon at Hogwarts, and Ron is incharge of the sitting plans.

Dumledore’s dining table can be thought of as an infinite row of seats with Dumbledore at one

end. Each of Dumbledore’s guests represents a character of English alphabet (a to z).

Dumbledore wants his guests to be seated such that the resulting string formed from the

alphabets should be lexicographically smallest (See examples for reference). He didn’t tell Ron

the total number of guests coming, but he will ask Ron to close the gate once all the guests

arrive (marking the end of incoming guests).


You are Ron, design a code using an efficient data structure that your magic wand will follow to

keep track of which guest to assign which seat. Explain the running time and also explain why

you have chosen the data structure which you have used.


How do we provide security to RMI classes? Write a program to implement Simple Student database application using RMI. Remote client consist of GUI for performing different database operations (For ex. Insert, delete, update) and retrieving data through RMI.


LATEST TUTORIALS
APPROVED BY CLIENTS