Java programs

  • Java
  • Thread starter Aman Gaur
  • Start date
  • #1
6
0

Main Question or Discussion Point

can anyone help in solving this program.....

write a program to create the series as 0 ,3 ,8 ,15 ,24 ,35........till n terms
 

Answers and Replies

  • #2
uart
Science Advisor
2,776
9
Tell us if you have discovered the "pattern" in those numbers yet? Once you know the pattern then I think the program to generate those numbers should be very easy.
 
  • #3
CRGreathouse
Science Advisor
Homework Helper
2,820
0
Here's a Pari program you can convert:

Code:
seq(n)=print1(0);for(k=1,n-1,print1(" ,"if(k%6,[3,8,15,24,35][k%6],0)))
Output for seq(20):
Code:
0 ,3 ,8 ,15 ,24 ,35 ,0 ,3 ,8 ,15 ,24 ,35 ,0 ,3 ,8 ,15 ,24 ,35 ,0 ,3
 
  • #4
6
0
i understood the pattern as the difference between the series is like series of odd numbers...i don't know wat r u thinking it at as.....the reply u have given cannot be used in java...

can u help me to understand better...please
 
  • #5
uart
Science Advisor
2,776
9
i understood the pattern as the difference between the series is like series of odd numbers
Yes that's good, you could certainly implement that pattern in java. Have you made any attempt to implement it yet?

There is actually an even easier pattern to those numbers (other than the "difference = increasing sequence of odd numbers" one that you've already found).

Here's a hint: What do you get when you expand and simplify the expression [itex](n+1)^2 - n^2[/itex] and how does this relate to a sequence of increasing odd numbers?
 
  • #6
6
0
i didn't get it...sorry
 
  • #7
6
0
thank you sir...i got it ...as you said it......

thank you very much....

i need you help in another one like that....it says

write a program to print the following series as
55555
54444
54333
54322
54321
 
  • #8
378
2
thank you sir...i got it ...as you said it......

thank you very much....

i need you help in another one like that....it says

write a program to print the following series as
55555
54444
54333
54322
54321
55555-54321 = ?
54444-54321 = ?
54333-54321 = ?
54322-54321 = ?
54321-54321 = ?

Find relationship

so values ...f(x) = g(x) + 54321

run a simple for loop
 
  • #9
6
0
thank you sir,,,,,i am very thankful of yours to help me out in this crucial way......

thanks a lot.....

u r amazing
 
  • #10
6
0
sir i just want to clarify one statement that i am not able to understand......and that is

there is question regarding incometax which we have to make a program on java


a company has employees who are divided into four grades as follows :
grade basic DA(of basic) HRA(of basic)
1 10000 or more 40% 30%
2 5000 - <10000 40% 25%
3 <5000 but >2000 30% 20%
4 <= 2000 30% 15%

this statement....

"if the net salary which is the total of BASIC ,DA ,HRA is above Rs 50,000 per month then incometax at the rate of 30 % of the annual salary exceeding Rs 50,000 is deducted on monthly basis at source."

Taking the name of the employees and the basic monthly pay as inputs , a pay slip which contains name, grade , basic monthly pay ,DA , HRA , monthly income , net monthly salary , for employee is to be printed ....write a program to perform this job..

Sir....how can we find income tax at monthly basis...? when we are given to find it at annual basis....
 

Related Threads on Java programs

  • Last Post
Replies
12
Views
4K
  • Last Post
Replies
11
Views
86K
  • Last Post
Replies
3
Views
988
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
7
Views
3K
  • Last Post
Replies
10
Views
3K
  • Last Post
Replies
7
Views
19K
  • Last Post
Replies
18
Views
5K
Replies
2
Views
6K
Replies
6
Views
3K
Top