How do I convert from Integer Queue to String? -


ok, have simple, inefficient program, that's alright, thing know how print first 5 numbers of queue zeros without changing values of ssn1 through ssn5.

for example print 000001111, , not 111111111, still have values stored in queue. me that? hide them.

i trying convert integers of queue string, create substring, , print dummyint 5 time followed substring.

import java.util.*;  public class ssnqueue { public static void main (string args[]) {    scanner scan = new scanner(system.in);   queue<integer> ssn = new linkedlist<integer>();    int dummyssn = 0;    system.out.println("please enter each digit number of ssn");    system.out.print("enter digit number 1: ");   int ssn1 = scan.nextint();   system.out.print("enter digit number 2: ");   int ssn2 = scan.nextint();   system.out.print("enter digit number 3: ");   int ssn3 = scan.nextint();   system.out.print("enter digit number 4: ");   int ssn4 = scan.nextint();   system.out.print("enter digit number 5: ");   int ssn5 = scan.nextint();   system.out.print("enter digit number 6: ");   int ssn6 = scan.nextint();   system.out.print("enter digit number 7: ");   int ssn7 = scan.nextint();   system.out.print("enter digit number 8: ");   int ssn8 = scan.nextint();   system.out.print("enter digit number 9: ");   int ssn9 = scan.nextint();    ssn.add(ssn1);   ssn.add(ssn2);   ssn.add(ssn3);   ssn.add(ssn4);   ssn.add(ssn5);   ssn.add(ssn6);   ssn.add(ssn7);   ssn.add(ssn8);   ssn.add(ssn9);    integer.tostring(ssn);   string subssn = ssn.substring(5);    system.out.println("the ssn is:" + ssn);   system.out.println("the last 4 digits of ssn are:" + dummyssn + dummyssn + dummyssn + dummyssn + dummyssn + subssn);    } } 

there several issues here make unclear trying do. 1 thing, read in multiple int values (ssn1, ssn2...ssn9) add them queue. call integer.tostring(ssn) . . . expect error on line. seems want there use loop read values out of queue, assign them temporary string variable each time, , call substring function on temporary variable , print out result. right now, calling integer.tostring(ssn) on entire queue , don't think want. queue still typed integer (queue). not mention tostring method returns value supposed read variable or use @ time call it. calling on own line doesn't achieve because if returning value, not being kept code later use.


Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

trac - Modifying workflow to add a status and split on ticket type -

Delphi interface implements -