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

Array Write a Java program to find frequency of each character in a given string. Also display the length and the most frequent among the characters


Write a Java program to find a certain character in a string and replace it with a new character. Allow user to enter a string, find character and the replace character. Display the new string.


Write a Java program that allow the user to input for the two angles A, and B (all in degrees), and the side a of an oblique triangle. Thereafter, solve for the triangle using laws of sine. Draw the user interface. Note: The sum of the interior angle of a triangle is always equal to 180.


IN CONDITIONAL STATEMENT JAVA,

Outcomes:


 Create a program solution of the given problem applying Java conditional

statements

 Differentiate If, if-else and if-else if-else statements

 Use comparison and logical operators to handle conditional statements in java program.


Instruction:

Read and analyze each problem. Provide a JAVA program to satisfy the required

machine functionality.


Import all java utilities using the syntax: Import java.util.*;


Machine Problem:

Create a java program that would compute and display the total mobile services fee

incurred by a customer. Mobile services include text messages, calls in minutes and

mobile data usage in megabytes.


Each customer was given a customer ID that would indicate the type of mobile plan

he/she availed.


PLAN A

- Customer ID ending

with 0. Loyal member

has 5 digits and above

ID number.

- monthly fixed rate of

P500.00

- allows free text

messaging up to 250

messages. Beyond

that, each message is

charged 90 centavos.

- All-net calls up to 60

mins. Exceeding

minutes applies

P5/min.

- P5/MB. Free use of

mobile data up to

80MB.

- 20% discount from

the total charge for

Loyal member.


PLAN B

- Customer ID ending

with 5. Loyal member

has 5 digits and above

ID number.

- monthly fixed rate of

P750.00

- allows free text

messaging of up to 500

messages. Beyond

that, each message is

charged 70 centavos.

- All-net calls up to 120

mins. Exceeding

minutes applies

P5/min.

- P5/MB. Free use of

mobile data up to

100MB.

- 40% discount from the

total charge.


PLAN C

- Customer ID ending

with 2. Loyal member

has 5 digits and above

ID number.

- monthly fixed rate of

P1,200.00

- allows free text

messaging of up to

1,000 messages.

Beyond that, each

message is charged 50

centavos.

- All-net calls up to 240

mins. Exceeding

minutes applies P5/mins

- P5/MB. Free use of

mobile data up to

500MB.

- 60% discount from the

total charge.


INPUT: The first line of the input file will contain a single integer N that represents the

Customer ID number. Next line consists of 3 integer T, C and D, separated by commas

(,). T is the total number of text messages; C is the total number of calls in minutes and D

is the total data usage in MB.

OUTPUT: The total mobile fee of the customer applying all charges given in the

description and discounts if applicable. In addition, the program must also display an

offer to upgrade the plan type for customers who have exceeded their monthly fixed

rate by 200%. Ex. Plan A – total bill of P1,860.00 means the customer exceeded by

P1,360.00 or 272% from his/her monthly fixed rate of P500 (P1,860-500=1,360).


TEST CASE:

CUSTOMER ID: 39480

300 128 100

----------------------------------------------------

TOTAL ID: P 788.00


IN FORM OF JAVA OPERATION:

CREATE A PROGRAM THAT WOULD:


 Create a program solution of the given problem using Java Programming.

 Use basic system input/output of Java Programming

 Apply java arithmetic


Instruction:

Read and analyze each problem. Provide a JAVA program to satisfy the required

machine functionality.


Import all java utilities using the syntax: Import java.util.*;


Machine Problem:

You have 8 circles of equal size and you want to pack them inside a square. You want

to minimize the size of the square. The following figure illustrates the minimum way of

packing 8 circles inside a square:

Given the radius, r, find the area of the minimum square into which 8 circles of that

radius can be packed.


INPUT: A positive real number (between 0.001 and 1000, inclusivein a single line denoting the radius, r.

OUTPUT: For each test case, output the area of the minimum squarewhere 8 circles of radius r can be packed. Print 5 digits after the decimal.


Your output is considered correct if it is within ±0.00001 of the correct output.


TEST CASE #1

INPUT: 0.1

OUTPUT: 0.34383


INSTRUCTIOKS ARE GIVEN BELOW.

KINDLY WRITE A PROGRAM THAT WOULD:


1. Allow user to enter the size and element of an integer array. Display the sum and

average of all the elements.

2. Allow user to enter the size and element of a string array. Then ask the user to

give a string and display whether that string is present in array or not. (Letter case

doesn’t matter)

3. Allow user to enter the size and element of an integer array. Display all evenindexed elements (assume 0 is even)

4. Allow user to enter the size and element of a string array. Display the longest

string found in the array.

5. Allow user to enter the size and element of a string array. Display the shortest

string found in the array.

6. Allow user to enter the size and element of an integer array. Display all oddindexed elements (assume 0 is even) in reverse order.

7. Allow user to enter the size and element of an integer array. Display the sum of

all even-indexed elements and sum of all odd of all even-indexed elements

(assume 0 is even)

8. Allow user to enter the size and element of character array. Display all vowels

followed by all consonants

9. Allow user to enter the size and element of character array. Then ask the user to

give another character. Check if that character is present in the array, if yes,

replace it with symbol “@”.

10. Allow user to enter the size and element of a string array. Display all strings that

starts with a consonant.


Suppose a business person launches new cinema at Islamabad and ask his team to develop a ticket system for box office. He assigns some requirements about system that how should it work. The requirements are such a way that there are only '5' number of box office windows in the theatre. Each window can have at max '20' number of people waiting in line. To start with, only one window is opened. If the number of people waiting in line in that window exceeds 20, then the next window is opened and people can join the line in that window. Likewise, if both the first and second windows have n number of people waiting in each queue, then a third window is opened. This can go on until the maximum number of windows w is reached. Let us assume that once a window is opened it never closes. A new window is only opened if all open windows are full. Each person can buy only one ticket. So, the system should not allot more than one ticket per person. Let us assume that the system issues one ticket each across all open windows. When a ticket is issued, the count of the number of people in each open queue is reduced by 1.

When a new person has to join the queue, the system has to prompt him to join a queue such that they are issued a ticket as fast as possible. The system prompts the person based on these factors: o First it looks for an open window with the least number of people and prompts that window number. If more than one window has the least number of people, then the system can prompt the person to join the first window (smaller window ld) it encounters with the least number of people. If the queues of all open windows are full and a new window can be opened, then the new person is prompted to join the new queue for the new box office window. O If all queues for all windows are full, a corresponding message is displayed. That person need not be considered in the next iteration .After a queue is prompted to a person, the person or system cannot change the queue.

Implement the system based on above scenario in java using suitable data structure.



Suppose a business person launches new cinema at Islamabad and ask his team to develop a ticket system for box office. He assigns some requirements about system that how should it work. The requirements are such a way that there are only '5' number of box office windows in the theatre. Each window can have at max '20' number of people waiting in line. To start with, only one window is opened. If the number of people waiting in line in that window exceeds 20, then the next window is opened and people can join the line in that window. Likewise, if both the first and second windows have n number of people waiting in each queue, then a third window is opened. This can go on until the maximum number of windows w is reached. Let us assume that once a window is opened it never closes. A new window is only opened if all open windows are full. Each person can buy only one ticket. So, the system should not allot more than one ticket per person. Let us assume that the system issues one ticket each across all open windows. When a ticket is issued, the count of the number of people in each open queue is reduced by 1.

When a new person has to join the queue, the system has to prompt him to join a queue such that they are issued a ticket as fast as possible. The system prompts the person based on these factors: o First it looks for an open window with the least number of people and prompts that window number. If more than one window has the least number of people, then the system can prompt the person to join the first window (smaller window ld) it encounters with the least number of people. If the queues of all open windows are full and a new window can be opened, then the new person is prompted to join the new queue for the new box office window. O If all queues for all windows are full, a corresponding message is displayed. That person need not be considered in the next iteration .After a queue is prompted to a person, the person or system cannot change the queue.

Implement the system based on above scenario in java using suitable data structure.


Bob employs a painting company that wants to use your services to help create an invoice

generating system. The painters submit an invoice weekly. They charge $30 per hour worked. They

also charge tax – 15%. Bob likes to see an invoice that displays all the information – number of

hours, the charge per hour, the total BEFORE tax and the total AFTER tax. Since this is an invoice, we

also need to display the name of the company (Painting Xperts) at the top of the invoice. Display all

of the information on the screen.


Mr. Akbar is senior software developer working on an ecommerce website he wants to add the following products on his website with following keys

Mouse 4614

Keyboard 5882

Cable 6713

Webcam 4409

Monitor 1825

To make searching better he asked his junior to find the 2 digit hash address of products by following techniques and share results with him 

a) Division method with m=97

b) Mid square method

c) Folding method without reversing

d) Folding method with reversing


LATEST TUTORIALS
APPROVED BY CLIENTS