Monday, July 27, 2009

Plz post you queries here

Hi Guys,
Please post your queries here. The "introduction" thread has grown too big so please avoid posting in there. Happy to help the beginners. Post your simple program requirements here. Expect queries/programs req. in c,cpp,c# also.

13 comments:

Anonymous said...

hai this is vary useful to add the scanner value program..........

Anonymous said...

how to feel to c++

ttran03 said...

Hello,

I have a java problem and I have no idea where to start. Here is the problem word for word.

PROBLEM:

A line in the plane can be specified in various ways:

- by giving a point(x,y) and a slope m

-by giving two points (x1, y1), (x2, y2)

-as an equation in slope-intercept form y= mx + b

- as an equation x = a if the line is vertical

Implement a class Line with four constructors, corresponding to the four cases above. Implement methods:

boolean intersects(Line other)
boolean equals(Line other)
boolean isParallel(Line other)

Whew!!!

I don't even know where to start! I think if I understood what they were asking I could start at least SOMEWHERE.

I'd appreciate any help.

Tony

Anonymous said...

Great post you got here. I'd like to read more concerning that topic.
By the way check the design I've made myself A level escorts

Unknown said...

Hello, pls help me in doing the java program to update the position of the TravellingPoint in a square.
-use simple loops
-use nested 'if' statement.
Position of a point in the plane is specified by its coordinates, two numbers: x and y, often written as a pair (x,y). The position of the point is repeatedly changed by the user who enters a direction for the point to move: up, down, left or right. Then one of the point's coordinates, x or y, will increase or decrease by one unit. Initially the point lies at (0,0) which is the centre of a square whose sides are 8 units long. If the user enters 'l' (for left) or 'r' (for right) then the first coordinate, x, will decrement or increment, respectively. Similarly, the second coordinate, y, will increment or decrement if the user enters 'u' (for up) or 'd' (for down).

The Program:
The program should display its purpose and the initial coordinates of the point. The program should then repeatedly prompt the user to enter in a new direction of the point. Once the user enters in a new direction, the program should update and display the new coordinates of the point.
The program displays the total number of moves and terminates when the point reaches the boundary on the enclosing square, i.e., if one of the coordinates, x or y, reaches the value of 4 or -4.

PRAVINTH G said...

import java.util.*;
import java.math.*;
import java.io.*;

public class ForTharini
{
int maxlen=4,minlen=-4;
int x=0,y=0; //u can use the java Point class...
int totalmoves=0;
boolean continueloop=true;
public static void main(String[] args)
{
new ForTharini();
}

public ForTharini()
{
java.util.Scanner scan=new java.util.Scanner(System.in);
System.out.println("Starting...\n Now u r @(0,0) Enter 'U' to move up, 'L' to move left, 'R' to move right, 'D' to move down\n");
System.out.println("Know ur square its 8X8 and u r @ center \n");
while(continueloop)
{
System.out.print("Enter ur move code U/L/R/D:");
String s = scan.nextLine().toUpperCase();
for(char c:s.toCharArray())
{
if(c=='U')
y++;
else if(c=='L')
x--;
else if(c=='R')
x++;
else if(c=='D')
y--;
else{
System.out.println("Invalid entry "+c);
continueloop=false;
break;
}
if(x<maxlen && x>minlen && y<maxlen && y>minlen)
{
System.out.println("\n Now u r @({"+x+"},{"+y+"})");
totalmoves++;
}else{
System.out.println("u crossed the boundary");
continueloop=false;
break;
}
}
}
System.out.println(" Total valid moves that u made="+totalmoves);
}
}

Unknown said...

please help
java program
create a static application class called RectangularPrism which asks users for dimensions of a rectangular prism and then displays the surface area and volume of the rectangular prism as well as the 6 sides.
asks the user for the units
displays a header "properties of a rectangular prism
remind the user that the numeric value must greater than 0

Unknown said...

can u help me write this code,i need help:
Write a full java program to create the array indicated below, and create a method called “summation” to calculate the summation of the array elements.
In the main method do the following:

a. Create the array and initialize its elements using for – loop.
b. Call “summation” to implement and pass the array to it.
c. Print out the result.

PRAVINTH G said...

/*code will work fine with java 6 and above*/
public class ForEK
{
public static void main(String[] args)
{
int[] array=new int[]{123,345,678,890,34567};
System.out.println("Summation is: "+Summation(array));
}
static long Summation(int[] array)
{
long res=0;
for(int intValue:array)
res+=intValue;
return res;
}
}

Anonymous said...

Write a Temperature class that has two fields: a temperature value (a floating-point number) and a character for the scale, either “C” for Celsius or “F” for Fahrenheit. Make sure that these two fields can ONLY be accessed through the accessor methods outside of the class.
I need java coding for the above question

Unknown said...

hi!!we are ask to create an Automated Teller Machine program using java. these are the terms we have to inlude in our case study
1. InputStreamReader and BufferedReader
2. while statement
3. do-while statement
4. try-catch (exception handling)and also
attributes/behaviors, Java beans, inheritance, abstract
classes, interfaces.
the program is asking for the name and the password of the user. hope you can help me!thank you

Unknown said...

and also the deposit,withdraw and anything else that are use in ATM!!

Anoop said...

Hello,

Can u please share with me the C code of the team selection problem in the codechef hard practice section.

My email id : anoopmittal.mittal@gmail.com

Thanks.....