ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
here is what I did, I need help with everything else
Quote:
//Name: ********
//Date: 10/9/2006
import java.util.Scanner;
public class CountLetters{
public static void main(String[] args){
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int e = 0;
int f = 0;
int g = 0;
int h = 0;
int i = 0;
int j = 0;
int k = 0;
int l = 0;
int m = 0;
int n = 0;
int o = 0;
int p = 0;
int q = 0;
int r = 0;
int s = 0;
int t = 0;
int u = 0;
int v = 0;
int w = 0;
int x = 0;
int y = 0;
int z = 0;
Firstly, no one is going to do your homework for you! Secondly, be more specific about what you need help with.
If I were you, I would start by looking at the comments in the code. You have obvisouly created the 26 ints, so now move onto getting a string as input. Break it down into managable chunks - you are fortunate, the program has already been structured for you.
I know nobody is going to do it for me, I am just totally confused on what am I supposed to do, and what is this thing supposed to do. Whe are doing if, else, and while now, so I am guessing it has something to do with that.
Read in a string (look at previous work that you have done)
Then once you have done that you want to loop through the string one character at a time, again your teacher has probably provided you with a similar example on how to achieve that.
The important thing about learning programming is not doing the whole problem, but learning to tackle it in small manageable chunks.
Three suggestions:
1. You definitely need to talk with your instructor.
We'd be happy to help when we can ... but this particular question was really too broad. Honestly.
2. Ask your instructor if tutoring is available.
Or - even better - see if any of your classmates might be interested in forming a study group together with you.
3. If you're serious about taking this course ... whether or not the teacher can spend any extra time with you, and whether or not tutoring is available ... then this book will DEFINITELY help you:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.