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 03:30
Which group on the home tab allows you to add shapes to a powerpoint slide?
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
Once the data center routes to the destination server that hosts the website, what's the next step in the internet process? user’s browser renders html code from destination server into web page request goes through router/model and isp request routed to nameserver and datacenter
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
The place where the extended axis of the earth would touch the celestial sphere is called the celestial
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
Which of these is a benefit of using objects in a powerpoint presentation? a. collaborators can create the external files while you create and edit the slide show. b. you can easily change the theme and design of the presentation. c. you can have older data in the source file while having up-to-date data in the presentation. d. collaborators can easily share the presentation.
Answers: 2
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, 04.07.2019 05:00
question
History, 04.07.2019 05:00