This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

need to find category

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi ,

I am getting the category like .Sr Prgorammer,Ass.Programmer and Programmer like etc
But i am unable to find out how many times the Sr.Progrmmer ,Ass.Prormmer etc can
be count using java code
Please help me.
Thanks


 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

pankaj semwal wrote:

But i am unable to find out how many times the Sr.Progrmmer ,Ass.Prormmer etc can
be count using java code



I don't get your question, Do you want to count How many times "Sr.Progrmmer ,Ass.Prormmer", category occurred in a given result set, Then just get the counter for each of category and increment it when you found that category
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what Sagar Rohankar is saying is the right solution. But If your concern is to get a sql statement that will also count the categories, you will have to build your sql statement with group by clause counting the categories
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.But using java code.

 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

pankaj semwal wrote:yes.But using java code.


Then whats the problem in adding counter and incrementing in the same code?, like

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

after that i have to calculate the total salary of each category
i.e
srProgrammerCounter++; // counter
System.out.println("cat"+category);
System.out.println("jobSalary in Sr"+jobSalary)*srProgrammerCounter;
srProgrammerSal=jobSalary+jobSalary*unit/100;


will this return the exact answer.
 
Muhammad Ijaz
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can calculate as follows:

srProgrammerCounter++; // counter
System.out.println("cat"+category);
System.out.println("jobSalary in Sr"+jobSalary*srProgrammerCounter);
srProgrammerSal=jobSalary+jobSalary*unit/100;
srProgrammerSal = srProgrammerSal*srProgrammerCounter;





Hope it will help

Pomy
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Muhammad Ijaz wrote:
srProgrammerSal = srProgrammerSal*srProgrammerCounter;


srProgrammerSal *= srProgrammerCounter;
 
Do you want ants? Because that's how you get ants. And a tiny ads:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!