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

write a java program that accepts an ordinary number and outputs its equivalent roman numerals. the ordinary numbers and their equivalent roman numerals are given below: ordinary numbers roman numerals.


You are given an array of N non-negative integers: A1, A2, ..., AN. An alternating subsequence is a subsequence in which the indices of any two consecutive elements differ by exactly two in the original array. That is, if Ai1, Ai2, ..., Aik is some subsequence, then for it to be an alternating subsequence, (i2 - i1 = 2), (i3 - i2 = 2), and so on should all hold true. Among all alternating subsequences, find the one which has maximum sum of elements, and output that sum.

Input
The first line of the input contains an integer T denoting the number of test cases.

The first line of each test case contains an integer N denoting the number of elements in the array.

The second line contains N space-separated integers A1, A2, ..., AN denoting the array A.

Output
For each test case, output a single line containing the answer.

Note
A subsequence with only a single integer is also an alternating subsequence.
Constraints
1 ≤ T ≤ 10
1 ≤ N ≤ 105
0 ≤ Ai ≤ 105

Misha was playing with Balanced Brackets alone. Mykhailo also wanted to play the game with her, so he comes up and asks her a question.

Misha is allowed to chose a sub-sequence (i.e. not necessarily contiguous substring) of brackets. AFTER chosing a the sub-sequence, she is allowed to re-arrange it (if needed) such that this chosen sub-sequence (after rearrangement) is balanced. Find the maximum length of this sub-sequence. (Please note that the resulting sub-sequence , after rearrangement MUST be balanced.)

Input:

  • First line will contain T
  • T, number of testcases. Then the testcases follow.
  • First line of each test case has an integer N
  • N, denoting length of string.
  • Second line of each test case has a string S
  • S which is the string. String will only consist of '(' and ')'.

Output:

For each testcase, the maximum possible length of balanced string.

Constraints

  • 1≤T≤10
  • 1≤T≤10
  • 1≤|S|≤10
  • 5
  • 1≤|S|≤105
  • String will only consist of '(' and ')'.

Given an array A of N integers and two integers X and Y, find the number of integers in the array that are both less than or equal to X and divisible by Y.

Input

  • The first line of the input contains an integer T denoting the number of test cases. The description of each test case follows.
  • The first line of each test case contains three space separated integers: NX and Y.
  • The second line contains N space-separated integers A1A2, ..., AN denoting the array A.

Output

For each test case, output a single line containing the answer.

Constraints

  • 1 ≤ T ≤ 10
  • 1 ≤ N ≤ 105
  • 1 ≤ A1, A2, ... ,AN ≤ 109
  • 1 ≤ X, Y ≤ 109







Chapter 7Assignment(Popular Candy)–15points Your goal is to record the sales for 4 different types of candy and determine the total sales and the names of the highest and lowest selling candies.

•Create a String array that stores four different types of candy. Pick whatever candy you would like.(3points)•

Have the program prompt the user to enter the number of candy boxes sold for each type of candy using an array. Do NOT accept negative values for the number of candy boxes sold. Store these numbers into an integer array.(6 points )

•Display the total sales, and the names of the highest selling and lowest selling candy items.(6points)



Write a Java program to display the three top sales made by employees of an organization. The rows and columns represent the sales made by each employee identified by their employee number. SALES 1 SALES 2 SALES 3 101111 R 3 000 R 2 000 R 3 500 101122 R 2 500 R 5 500 R 3 500 101133 R 1 100 R 2 000 R 4 500 101144 R 1 700 R 2 700 R 2 500 101155 R 5 000 R 2 900 R 5 900 Using a Two Dimensional array produce the employee sales report, and the total sales made by each employee.


To qualify for an International Conference for Women in Computing (ICWC) next year in Toronto, Canada a student have got a distinction (a mark greater than 75) in PRG510S, be a female, and below the age of 25. Write a simple program that receives a mark, gender, and age from the keyboard and displays a corresponding message basing on the input.
Sample Run 1:
Mark: 70
Gender: female
Age: 21
Output1: Unfortunately you do not qualify!


Sample Run 2
Mark: 83
Gender: female
Age: 21
Output2: Congratulations! You might be in Toronto, Canada next year for ICWC!

CreateabaseclasscalledAnimalwhichhas2classfields.ThefirstfieldholdsanintegerIDtagfora numberthatazoousestocataloguetheiranimals&thesecondfieldholdsastringcalledspecies. FromtheAnimalclass,derive2classesOneisBird&theotherReptile.Birdclasshasanadditional classfieldcalledcolourwhichholdsthe colour of the birds feathers(int – 1=grey, 2=white, 3=black).reptile class has an additional class field called bloodTemp which hold the reptiles temperature of their blood (double).You need to instantiate two 2 objects.bird object will be called brd.reptile object called rept.Input values for the bird’s IDtag,species & feather colour(int) & for the reptile’s IDtag number,species & bloodTemp.Override the Animal class’s input & output methods.Each derived class must have its own constructor.Write methods to input & output values to the class fields for all classes & then print out the values of the bird & reptile class fields with labels identifying the values. 


Write a java program where a user enters and stores the average monthly rainfall figures (int) for three (3) towns over a year. The rows represent the months, and the columns represent the towns.


Calculate and print the total rainfall figures for each town, and the average rainfall for each month. Use a switch statement to print out the month name according to the column subscript value (E.g. if col = 0, then print January, col = 1 then print February, etc.) with the corresponding total alongside it.


write a simple application which takes data from the console and saves it to a file. The program should take the following data:

name, address and phone number. The program should have a menu which allows users to load data from previous sessions.


LATEST TUTORIALS
APPROVED BY CLIENTS