or join us in IRC
Server Details: irc.torn.com
Port: 6667
Channel: #BeginnersCPP
IRC Rules:
- No linking to things that break any US laws
- Keep chat pg-13 rated in general areas
- Be patient, I need to sleep sometime
- Proper English is a huge plus, especially if you want to be helped in a timely fashion
- If you have a question about code, please post it to ideone.com
Is this website still running and maintained?
It’s still around and running, I’ve been super-busy with work and school but if you ever have any questions feel free to drop them my way.
How do I fix this so it counts how many numbers the user puts in so I can change it into a if else statement?
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.println(“Please enter your 10 digit #. “);
long nrmNum= 1111111111;
long phoneFmt = 0l;
phoneFmt = (long) input.nextDouble();
//get a 12 digits String, filling with left ’0′ (on the prefix)
DecimalFormat phoneDecimalFmt = new DecimalFormat(“0000000000″);
String phoneRawString= phoneDecimalFmt.format(phoneFmt);
java.text.MessageFormat phoneMsgFmt=new java.text.MessageFormat(“({0})-{1}-{2}”);
//suposing a grouping of 3-3-4
String[] phoneNumArr={phoneRawString.substring(0, 3),
phoneRawString.substring(3,6),
phoneRawString.substring(6)};
nrmNum /= 1;
if (phoneFmt == nrmNum ){
System.out.println(” Your Phone number is: “);
System.out.println(phoneMsgFmt.format(phoneNumArr));
}
else {
System.out.print(“Please input 10 numbers for the phone #”);
System.out.println(phoneMsgFmt.format(phoneNumArr));
}
}
}