I'm attempting to make a small program that when a user inputs a string, it counts all the letters. Here's what I've got so far: import java.util.Map; import java.util.HashMap; import java.util.Set; import java.util.TreeSet; import java.util.Scanner; public class LetterTypeCount { public static void main(String[] args) { // create HashMap to store String keys and Integer values Map<String, Integer> myMap = new HashMap<>(); createMap(myMap); // create map based on user input displayMap(myMap); // display map content } // create map from user input private static void createMap(Map<String, Integer> map) { Scanner scanner = new Scanner(System.in); // create scanner System.out.println("Enter a string:"); // …

Member Avatar
Member Avatar
+0 forum 3

The output comes out wrong it should be different: //This is what I have Enter a sentence: Today Is Thr Jan, 2015 Number of uppercase letters.........2 Number of digits....................2 Number of vowels....................2 Press any key to continue . . . //The output should look like this: Enter a sentence: Today Is Thr Jan, 2015 Number of uppercase letters.........4 Number of digits....................4 Number of vowels....................4 Press any key to continue . . . #include <iostream> #include <iomanip> #include <string> using namespace std; int main() { char c; int Uc = 0, Dc=0, Vc=0; string vowels("aeiouAEIOU"); cout << "Enter a sentence: "; …

Member Avatar
Member Avatar
+0 forum 5

Hi guys I'm new to php. I've been given a task to write a code in php that would allow the user to input his initials and the program should out his/her initials as a star pattern. E.g if your initials T.T,it should be as follows... ***** ***** * * * * * * Please help!! Have no idea where to start!!

Member Avatar
Member Avatar
+0 forum 13

Hello. I have a app designed to organize dir’s on on the C drive where it was created. XML is extensively used in the business logic and house cleaning etc. public static final String USERHOMEDIR = System.getProperty("user.home", "."); <linkPath> C:\Users\Steves\Documents\.targetGuide\admin_\admin\Note Folder\test\c drive test tab\index </linkPath> public static final String USERHOMEDIR = System.getProperty("user.home", "."); Now, this app is running from a jump drive. Its intended purpose is to run as a standalone app on a jump drive and organize dir’s on the same thumb drive. Now, when My XML is written it is in a different pattern that looks like this …

Member Avatar
Member Avatar
+0 forum 3

My programs objective is to mkdir and ope dir. if I ever get it jarred up I would like to run it from a jump drive. [code] public static final String USERHOMEDIR = System.getProperty("user.home", "."); [/code] clearly this code will not be valid any more. Could this USERHOMEDIR be replaced correctly each time the jump drive is moved from one client to the next? again the main objective of the program would be to create dir's and place doc in a a file system on the jump drive and maintain access to those dir no matter where I use the …

Member Avatar
Member Avatar
+0 forum 13

im creating a simple calculator and i dont know how to disable letter in the textbox.. can someone help me please...newbie here....BTW im using VB6...

Member Avatar
Member Avatar
+0 forum 7

Hi guys can you please help me with this. All I need to do is input a number and display the corresponding alphabet.For example 2 then the output should be A B.. I am working on a code but my problem is the output is displaying together with a special character. Can you help me do it pls. Thanks in advance! #include<stdio.h> #include<stdlib.h> #include<conio.h> int main() { int num; char *buffer; printf("How long is the string:"); scanf("%s",&num); buffer=(char *) malloc(num); if (buffer==NULL) exit(1); for(int i=0;i<num;i++) { for (int j=0;j<i;j++) buffer[j]=(i%26)+'A'; printf("The strings are: %s \n",buffer); getch(); free(buffer); } return 0; …

Member Avatar
Member Avatar
+0 forum 2

string word = "abcde"; int count = 0; for(int i = 0; i < word.length(); i++){ for(int j = 1; j < word.length(); j++){ if(word.at(i) == word.at(j)){ count++; } } } i am trying to write a program that when i am given a string i can count letter pairs in the string so for example: cat returns 0 and doggy returns 1. this i what i have written now and i tried cout the loops and such but im still very lost in what i am doing wrong. any help would be very helpful

Member Avatar
Member Avatar
+0 forum 1

I'm causing input letters to write ones into variables through an array. I'm trying to count the occurences of ones in a variable. Lets say I input aaaaa. The count output displays 12345. Instead of outputting the whole count of numbers, I want to output the biggest number in the count. How can I do that?

Member Avatar
Member Avatar
+0 forum 2

Sooo yeah. Not one of those derps begging for a solution, but my solution simply isn't working out how I want it to. TLDR; Letters A-T are supposed to obey the number of coulmns entered by the user, then output them. My program obeys the number of coulmns by recognizing your input, but it does not put the letters back into the number of coulmns accordingly. It is just outputting them. I know there has to be some really stupid, silly issue I'm overlooking but Im trying to finish this up. Any help is good help. #include <cmath> #include <iostream> …

Member Avatar
Member Avatar
+0 forum 2

Hi guys, Could somebody help me in decrimenting the letters cause code like below exists $let = 'A'; for($x=1;$x<256;$x++){ echo $let++.'-'; } //output: A-B-C-D-E....... i just wonder how about decrimenting it like $let--; but it didnt work does anayone has the idea on how to generate $let-- thanks,

Member Avatar
Member Avatar
+0 forum 2

hello everyone I really need help so I have to make functions that find vowels, digits and uppercase and lowercase letters from a sentence inputted. So i was able to do it all in main but i cant seem to make the new program work with the functions properly, it says on the compiler that it has no errors but ones i debug it, it shoes the wrong answers. would really appreciate the help. this is what i have so far with the functions #include <iostream> #include <cctype> #include <string> #include <iomanip> #include <algorithm> using namespace std; int findUpper(char ch); …

Member Avatar
Member Avatar
+0 forum 2

hey! i need a quick answer.... how can i move the letters so that they will start from right to left and ***not*** from left to right? i writing in hebrew and i looks weird if it start from left to write! for example: that how it should start: שלום לכולם but the problem that it is start like this: שלום לכולם can you please help me? thanks

Member Avatar
Member Avatar
+0 forum 3

Alright, I have Textbox where I want only Numbers and Letters and backspace allowed. I don't want copy and paste, or spacebar or other ascii charachters. Can anybody help me?

Member Avatar
Member Avatar
+0 forum 1

Hello I'm having major issues, please help me with this code; (Generating random characters) Use the methods in RandomCharacter to print one hundred uppercase letters and then one hundred single digits, and print ten per line. Use these methods: public static char getRandomUppercaseLetter(){ return getRandomCharacter('A', 'Z'); } public static char getRandomDigitCharacter(){ return getRandomCharacter('0', '9'); } I just don't know how to work it into these methods. Try and keep it simple, i'm still new to coding. Thanks!

Member Avatar
Member Avatar
+0 forum 9

Ok guys I'm almost done with my GPA program but I hit a snag. everything works fine but when I insert a letter grade the program doesn't read what number it corresponds to and sets double number to zero. Can some please let me know what I'm doing wrong. [CODE]import java.util.Scanner; public class StudentGPA { public static void main (String args[]){ //User inputs the number of classes he/she has Scanner input = new Scanner (System.in); System.out.println("Please enter your number of classes"); int classes; classes = input.nextInt(); String Grade = ""; int totalHours = 0; int totalHoursEarned = 0; int hours; …

Member Avatar
Member Avatar
+0 forum 2

I'm creating a class for a text analysis for letter frequency. I am trying to compile it, but i'm having some problems. Could someone look at this for me? This is what I have so far: [CODE] class Analysis { private: string letters[26]; string text; int count; public: Analysis() { string letters[26] = {0}; string text = 0; int count = 0; } Analysis (string l, string t, int c) { letters[26] = l; text = t; count = c; } void set(string l, string t, int c) { letters[26] = l; text = t; count = c; } string …

Member Avatar
Member Avatar
+0 forum 7

Program reads in a word and outputs the last character then a "," then the last 2 characters of the word

Member Avatar
Member Avatar
+0 forum 5

this code is meant to input words from file, and output to file the amount of letters in them and how many words there are [CODE]#include<iostream> #include<iomanip> #include<fstream> #include<cmath> #include<conio.h> #define in_file "data.txt"//input file name #define out_file "result.txt"//output file name using namespace std; void inputwords(int&, int&); void outputwords(int, int); ifstream ins;// associates ins as an input stream ofstream outs;// associates outs as an output stream int letters=0; int words=0; char ch; int main() { ins.open(in_file);// associates ins as an input stream outs.open(out_file);// associates outs as an output stream bool charcheck; inputwords(letters, words); outputwords(letters, words); ins.close();// closing input file outs.close();// closing …

Member Avatar
Member Avatar
+0 forum 7

Hi I'm trying to make a program that returns the number of letters in a string but it seems that the function I have is not working as it returns 0 every time. Can someone check what I'm doing wrong? Thanks in advanced. [CODE]#include<iostream> #include<string> using namespace std; unsigned letters(const string a); int main(){ int i; string a; cin >> a; cout << letters(a); system("pause"); } unsigned letters(const string a){ int i; int countL = 0; for(i=0;a[i]!='\0';i++){ if (a[i] >= 'A' && a[i] <='Z' && a[i] >= 'a' && a[i] <= 'z') countL++; } return countL; } [/CODE]

Member Avatar
Member Avatar
+0 forum 9

The End.