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

This is a UML class diagram using Java syntax for the members. It is a summary of the design. The full details will follow.
AccountNumber
private int[] digits
public AccountNumber(boolean random)
public String toString()
public static AccountNumber fromString(String number)
private int checksum()

This version uses UML syntax for the members.
AccountNumber
-digits : int[]
+AccountNumber(random : boolean)
+toString() : String
+fromString(number : String) : AccountNumber
-checksum() : int

Fields
private int[] digits

Constructors
public AccountNumber(boolean random)

Methods
public String toString()
public static AccountNumber fromString(String number)
private int checksum()

Implement AccountNumber.checksum() and the constructor and test it with a program that generates random, valid account numbers. Use a command line argument to specify how many numbers to generate, as follows:
$ java Generate 2
342 111 920 50
273 960 195 72
$
An AccountNumber object will store one Destiny Energy (DE) account number. This is a UML class diagram using Java syntax for the members. It is a summary of the design. The full details will follow.
AccountNumber
private int[] digits
public AccountNumber(boolean random)
public String toString()
public static AccountNumber fromString(String number)
private int checksum()

This version uses UML syntax for the members.
AccountNumber
-digits : int[]
+AccountNumber(random : boolean)
+toString() : String
+fromString(number : String) : AccountNumber
-checksum() : int

Fields
private int[] digits

Constructors
public AccountNumber(boolean random)

Methods
public String toString()
public static AccountNumber fromString(String number)
private int checksum()

Implement AccountNumber.toString() and test it as follows:
$ java Test1
000 000 000 00
$
Build a project. This project is a web-based online shopping application developed in JAVA LANGUAGE using Java as front end. The main aim of “ONLINE SHOPPING” is to improve the services of Customers and vendors. It maintains the details of customer payments, product.
I have to create a class that represents a rectangle. A rectangle is specified by the coordinates (x; y) of its top-left corner and its width and height.
This class will be used to create many rectangle objects, and it must feature:
{ dynamic fields (variables) to store x, y, the width and the height as fractional numbers;
{ a constructor with parameters that provide x, y, the width and the height;
{ a function that returns the area of the rectangle;
{ a function that returns the length of the perimeter of the rectangle; and
{ a function that returns a string representation of the rectangle, the four numbers, within a pair
of parentheses, separated by commas. This function must be named toString().

Write, in a separate Main class, a main method that accepts the four numbers as command line
arguments, instantiates a rectangle object, and prints the string representation of the rectangle, the area and the perimeter.
I have to write a program that accepts two command line string arguments and prints the lesser of them, if case is ignored. The program should look like this when it runs:
$
java Main Zoophyte aardvark
aardvark
$

This is the code I have so far:
public class LeastString {

public static void main (String[] args) {
String s = args[0];
String t = args[1];
System.out.println(s.trim());
System.out.println(t.trim());
System.out.println(s.compareToIgnoreCase(t));
if (s > t) {
System.out.println(s);
} else (s < t){
System.out.println(t);
}
}
}
what is a generic class???can u provide a simple demo program??
Imagine a typical stock market scenario
• Trading happens 5 days a week. Exchanges are closed on weekends
• There are a fixed set of securities on which trading happens
• If one buys at low price and sells at a high price, one makes a profit. Vice-versa results in a loss

For purpose of this problem, assume that
• 1st of the month is a Monday and a month comprises of 30 days. Hence there are 22 working days
• There are no holidays on any week day
• There are only 5 securities listed on the exchange
• Price of a given security is constant for a given day

Given above assumptions, the following conventions are followed
• Input data comprises of price of the securities for all 22 working days of the month and your trade records
• Output is to find out position in terms of securities held and / or Profit/ Loss at the end of the month
Constraints:
Date will be always be between 1 and 30 (both inclusive)
You are given a square matrix of dimension N. Let this matrix be called A. Your task is to rotate A in clockwise direction byS degrees, where S is angle of rotation. On the matrix, there will be 3 types of operations viz.
1. Rotation
Rotate the matrix A by angle S, presented as input in form of A S
2. Querying
Query the element at row K and column L, presented as input in form of Q K L
3. Updation
Update the element at row X and column Y with value Z, presented as input in form of U X Y Z
Print the output of individual operations as depicted in Output Specification
scanf("%d",&R);
for(i=1;i<=R;i++)
{
scanf("%d%d",&f[i],&s[i]);
if((f[i]<1&&f[i]>N)||(s[i]<1&&s[i]>N))
return 0;
}
for(i=1;i<=R;i++)
{
if(f1)
{
if(flag==0)
{
break;
}
else
flag=0;
}
if(f[i]-1>=1)
if(A[f[i]-1][s[i]]!='x')
flag=1;
if(f[i]+1<=N)
if(A[f[i]+1][s[i]]!='x')
flag=1;
if(s[i]-1>=1)
if(A[f[i]][s[i]-1]!='x')
flag=1;
if(s[i]+1<=N)
if(A[f[i]][s[i]+1]!='x')
flag=1;
f1=1;
}
if(flag==1)
printf("YES");
else
printf("NO");
return 0;
}
Im learning Java through the codingbat website. Im working on problem http://codingbat.com/prob/p121193
I have coded:
if (str.length() == 0) return 0;
int sum=0;
int start = 0;
int stop=0;
int f=0;
int j=0;
for (int i=0;i<str.length()-1;i++){
if (Character.isDigit(str.charAt(i))){
start = i;
if (i == str.length()-1) stop = i;
for (j=i+1 ;j < str.length()-1;j++){
if (!Character.isDigit(str.charAt(j))){
i = j;
stop = j;
j = j+ str.length();}
else {stop = j;}
}
sum += Integer.parseInt(str.substring(start,stop));
}
}
return sum;
}
This code passes a few of the tests. When value "aa11b33" enters the program and "start" (i) = 5, the "for" loop should start at j=6. In trying to figure out whats wrong, I commented out the "sum+=...." code and returned "stop". It returns a result of 4. Looking for advice on why this is happening. Thanks in advance NB
LATEST TUTORIALS
APPROVED BY CLIENTS