subject

Write a program that prompts the user to enter a social security number in the format ddd-dd-, where d is a digit. your program should check whether the input is valid.

hint: use chatat() and isdigit() methods.

ex.

input: 111-11-

output: valid ssn



input: 11-11-

output: invalid ssn

i know that i can solve this problem by looping through the characters of the string in the ssn but i want to make the code i wrote beneath work. i am having a problem on my second to last if- statement. in that statement it says that all of my variables d1-d9 "cannot be resolved to variable." i initially thought that this might be a problem with scope of my variables but i dont belive it is. why am i getting an error and what can i do to make this code work

import java. util. scanner;

public class checkssn {

public static void main(string [] args) {

scanner kbd_in = new scanner(system. in);

system. out. print(" enter your social security numer in the format ddd-dd-: ");

string social = kbd_in.();

system. out. println(" you have entered: "+ social);

kbd_in. close();

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:30
Linda subscribes to a cloud service. the service provider hosts the cloud infrastructure and delivers computing resources over the internet.what cloud model is linda using
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
Which describes careers that have similar education requirements but different qualifications? product safety engineers and materials engineers industrial safety engineers and industrial health engineers quality control systems managers and inspectors industrial safety and health engineers and hand packers
Answers: 3
question
Computers and Technology, 24.06.2019 17:40
The value of sin(x) (in radians) can be approximated by the alternating infinite series create a function (prob3_2) that takes inputs of a scalar angle measure (in radians) and the number of approximation terms, n, and estimates sin(x). do not use the sin function in your solution. you may use the factorial function. though this can be done without a loop (more efficiently), your program must use (at least) one. you may find the mod() function useful in solving the problem.
Answers: 1
question
Computers and Technology, 24.06.2019 19:30
Can someone who is skilled at coding create me a java chess game. don't copy from online source codes. make it original ! : d
Answers: 1
You know the right answer?
Write a program that prompts the user to enter a social security number in the format ddd-dd-, where...
Questions
question
Mathematics, 29.09.2019 12:30
question
Mathematics, 29.09.2019 12:30
Questions on the website: 13722361