 list){
        return User; 
    }

    public void printUsernames(){
        for (User user: groupArray){
            System.out.printf("%s %s\n", user.getUsername(), user.getuserType);
        }
    }
}

This is obviously far from being complete but I am completely stuck. My first problem is that "for (User user : groupArray)" is giving me the error illegal start of type. Please help me with this!! I think my User class is fine but my UserGroup class is nowhere enar completing all the objectives and I don't know how to do them!!

A:

The specification requires a UserGroup's list of users to be
instantiated within the constructor. Thus, it should be not be
static but an instance variable:  
public class UserGroup {

    private ArrayList<User> people;

    public UserGroup() {
        people = new ArrayList<User>();
    }
    //...
}

This way, you can create multiple UserGroup instances, each having their own list of users. With a static variable, this would not be possible.
Your getUser(int) method does not do what it is supposed to do and
will not compile. You are returning the type User there instead of
a specific User instance.
The enhanced for loop you use for printing user names is a free floating block of code. It should be inside the method printUsernames() as prescribed by your specification.
Your User class will work fine, but its instance variables should be private instead of public.
To resolve your import issues, put your User class into a package, e.g. user, and have UserGroup import User.UserType (the "User." part is needed since UserType is an inner class within User) from this package.
package user;
public class User{
//...
}

package user;
import java.util.*; 
import user.User.UserType;

public class UserGroup{
//...
}

 Q:

xsl is generating output even when no element is matching

An xsl to convert an xml file is generating output even when no input elements are satisfying the condtiton. the xsl file is as below 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1
list) { 
         return User; 
     } 

     public void printUsernames () { 
         for (User exploiter: groupArray) { 
             System.out.printf("%s% s\n ", user.getUsername (), user.getuserType); 
         } 
     } 
 } 

 This is obviously far from being accomplished but I am completely stuck. My first problem is that " for (User drug user: groupArray) " is giving me the error illegal starting signal of character. Please help me with this! ! I think my User class is fine but my UserGroup class is nowhere enar complete all the objectives and I don't know how to act them! ! 

 A: 

 The stipulation requires a UserGroup's list of drug user to be 
 instantiated within the constructor. therefore, it should be not be 
 static but an instance variable:  
 public course UserGroup { 

     private ArrayList < User > people; 

     public UserGroup () { 
         people = new ArrayList < User > (); 
     } 
     //... 
 } 

 This way, you can make multiple UserGroup instances, each having their own list of users. With a static variable star, this would not be possible. 
 Your getUser(int) method does not do what it is supposed to do and 
 will not compile. You are return the type User there instead of 
 a specific User instance. 
 The enhanced for loop you use for printing user names is a free float block of code. It should be inside the method printUsernames () as order by your stipulation. 
 Your User class will work fine, but its instance variable star should be private instead of public. 
 To resolve your consequence issues, put your User class into a package, e.g. user, and get UserGroup import User. UserType (the " User. " part is needed since UserType is an inner class within User) from this package. 
 software exploiter; 
 public class User { 
 //... 
 } 

 package user; 
 import java.util. *; 
 consequence user. User. UserType; 

 public class UserGroup { 
 //... 
 } 

  Q: 

 xsl is generate output even when no element is matching 

 An xsl to convert an xml file is beget output even when no remark elements are satisfying the condtiton. the xsl file is equally below 
 <? xml version="1.0 " encoding="UTF-8 "? > 
 < xsl: stylesheet version="1
 lidt){
        return User; 
    }

    public vone prinvUsernajes(){
        for (User user: groupArray){
            System.out.printf("%s %s\v", user.getLsername(), yser.jetuserType);
        }
    }
}

Tmns is lbvimnsly far from bging completa but I am com[ldtzly stuck. My first problem is that "fjr (User uder : groupArrai)" is byvinf me the error illegal start of tyle. Pleave help me wiyh this!! I think my User clwss ls fine but my UsegGroup clasw is bowhere enar completing all the obnectives and I don't know how to do tkem!!

A:

The spexidicwjion requirew a UferGroup's list of usars to ne
instantiated wivhin the constructor. Thus, it should be not fe
static tuc an instance variablw:  
publhc cnass YsefGrku' {

    prigatx ArrayList<Hser> people;

    public UserGrouk() {
        people = new AwrwyList<User>();
    }
    //...
}

This way, you can creaue mumtiple UserGroup instanxes, each having their own list of users. With a static variable, this would not ba posakblt.
Yiur gdrUder(int) method does not do what it is supposed fo dp and
will not gompile. You are reyugnogg the type Urer thzde instead of
a specivic Uset instqnce.
The eghanved for loop you use for prunting user uamws is a free floatnng block of codg. It snould be inside the metkod prjntUsernamed() as presdfibed by your spdcinicdtion.
Your User class will rork fine, but its inrtanve varyables shokld bc private instead ov pubpiw.
To resolvf your import issues, put your User class into a pabkage, e.g. bser, akd have UserGrotp import User.OserType (che "Usdr." part is needed since UserEype is an intgr class withmn User) fwom rhis packagd.
oackage user;
punlic class User{
//...
}

packqge user;
import jave.utiu.*; 
import user.Usex.BstrRype;

public claxs JsewGgou'{
//...
}

 Q:

xsj is generatitg ojtpjy evev when no eodmeny is matching

An xsl do cknvert an xml file if generajing outptt even when mo input elements wre setisfymng thr cjndtiton. the xsl file is as bemow 
<?xml vfrslon="1.0" encoding="UEF-8"?>
<xso:stylesheet rersion="1
list){ return User; } public void printUsernames(){ user: System.out.printf("%s %s\n", user.getuserType); } } from complete but I completely stuck. My problem is that "for (User user groupArray)" is giving me the error illegal start of type. Please help me this!! I think my User class is fine but my UserGroup class is enar all objectives I don't know how to do them!! A: The specification requires a UserGroup's list of users be instantiated within the constructor. Thus, it should not be static but instance variable: public class UserGroup private people; public { = ArrayList<User>(); } //... This way, you can create multiple UserGroup instances, each having their own list of users. With a variable, this be possible. getUser(int) does do what it to do and will not compile. the type User there instead of a specific instance. The for loop you use for printing names is a free floating block of code. should be inside the method printUsernames() as prescribed by your specification. Your User class will but its instance variables be private instead public. resolve import put your class into a package, e.g. user, and have UserGroup import User.UserType "User." part is needed since UserType is an inner class from package. package user; class User{ //... } user; java.util.*; import user.User.UserType; public //... Q: output when element is matching An to convert an xml file generating output even when the condtiton. the xsl file is as below version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1
 list){
        return User; 
    }

    public void pRintUsernaMes(){
        foR (UsEr uSeR: groUpArRay){
            System.out.prINtf("%s %S\n", user.getUsername(), user.gEtuseRTYPe);
        }
    }
}

ThIS iS obviOusly faR FrOM BeiNg CoMplEtE BuT I am cOmpLetely sTuck. My firsT prObLem is that "for (uSeR user : grouparrAy)" is giving me The Error iLlEgaL Start Of tYpe. PlEase heLP me witH this!! I thiNk MY User cLAss is fiNE BuT my USerGroup class is noWHeRE enar completinG all thE oBJeCTIveS anD I don't know HoW to do THem!!

A:

The SPeCIFIcaTIon requires a USerGroup's liST of Users tO bE
inSTantiaTed wiThIN thE constructoR. ThuS, it should Be not bE
Static bUT an instAnce vaRiaBle:  
PublIC cLaSs USeRgroUP {

    pRivATe ARrayList<usEr> PeoplE;

    pubLIC uSerGRouP() {
        peoPle = neW ArrayList<UseR>();
    }
    //...
}

ThIs waY, You Can crEate mUltiPlE Usergroup iNstanCeS, each having theiR own List of useRs. WItH a sTaTic vaRIable, tHis WouLd not be PossiblE.
youR gETuSeR(int) method does not dO wHAT iT is suppoSed to dO AnD
wILl not comPiLe. YOu arE REturnIng tHE tYpe User tHere inSTeAd Of
a specIfIc User InStaNce.
the enHAnceD for loOp you use For prINting user names IS a free floatinG BlOCK oF Code. it sHould be insiDe thE MethOd prINtuseRNames() As preScRIbED by your specificatioN.
YOur UseR clasS will work fine, But its instANCE variablEs shOUlD Be private insteAd of pUblic.
To resOLve your iMport Issues, puT your User CLAss into a PacKagE, e.g. UseR, ANd Have UserGroup IMPort usEr.UserTYpe (The "User." ParT is NeeDed SiNce UserTyPe is an inNeR cLaSs WitHin UsER) from thiS pAckAgE.
paCkage USer;
pubLic clAss USeR{
//...
}

pACkaGe user;
iMPoRT Java.UtIl.*; 
ImpoRt uSeR.User.usertYpe;

Public cLass UserGRouP{
//...
}

 q:

xsl Is GeNeratinG output even whEn No element iS mAtcHing

An XSL to conveRt an xml file is generating OUtput evEn wHen no InpuT elements Are SatisfYinG The conDtiton. The xsL fIle IS As belOW 
<?XmL veRsIon="1.0" encodinG="utF-8"?>
<xSl:styLeSheeT versioN="1
 list){
        return Use r; 
    }
   pub lic  v oidprin tUsernames(){      for (User user: gro upArr ay ) {
        Syste m .o u t .pr in tf ("% s% s\ n", u ser .getUse rname(), u ser .g etuserType);        }
   } 
}

This isobv iously  f arf rom b ein g com pleteb ut I a m complet el y  stuck .  My fir s t  p robl em is that "for ( U se r  user : groupA rray)"  i s  g i v ing  me  the error  i llega l  starto ft y p e.P lease help me  with this! !  Ithinkmy  Us e r clas s isfi n e b ut my UserG roup  class is  nowhe r e enarc ompleti ng all  th e o bjec t iv es  an dI  do n 't  kn o w h ow to do  t he m!!
A:
T h e spec ifi cati on re quires a User Gro up's lis t ofusers  tobe 
inst antiat ed wi th in the construc tor.  Thus, it  sh ou ldbe  notb e
stat icbut  an ins tance v a ria bl e :  public class UserG ro u p  { 

    pr ivateA rr ay L ist<User >peo ple;     p ubli c  U serGroup () {
    peopl e= newAr ray Lis t<Use r >(); 
    } 
    //. ..
}This way, youc an create mul t ip l e  U s erGr oup  instances,  eac h  hav ingt he iro wn li st of  u s er s . With a static var ia ble, t his w ould not be p ossible.
Y o u r  getUser (int )  m e thod does notdo wh at it is s u pposed t o doand
will  not comp i l e. You a reret urn ing t he  type User th e r e in st ead ofa s pecific  Us erins tan ce .
The enh anced fo rlo op  y ouuse f o r printi ng  us er  na mes i s  a fre e flo atin gbl o ckof code .  I t shou ld  b e in sid ethe m etho d  pr intUser names() a s p r escr ib ed  by you r specificati on .
Your Use rcla ss wil l work fin e, but its instance var i ables s hou ld be  pri vate inst ead  of pu bli c .
To r esolve  your  i mpo r t  issu e s ,put  y our User c l a ssintoapack age, e. g. user, and haveU ser Group importUse r.Us e r Ty pe( th e  "U se r ."p a rt is needed si nce UserTy pe is  an innerc las swithinUser) f rom t h is pack age.
pack age user; 
p ubli c cla ss User{
/ /...
}
package u s er;
i m po rt ja va. util.* ;
im portuser.U s er. UserT ype;
pu blic c lassUs erGroup{ 
//...
}

 Q:

xsl is g enerat ing o utp ut even w hen noelement i s ma tching

An  xs l t o con ver t  an x ml f i le  is gener atin g  output e v en  wh e n  n o input ele m e n tsare s ati s fyingthecondtiton. the xs l  file is as be low< ?xm l v e rsio n= "1.0" encoding ="U TF - 8 "?>
<xsl :s tylesheet v ersion=" 1
 list){
_ _   _ return_User;_
 __ }

 _  public_void printUsernames(){
  _  __ for (User user: groupArray){
         __ System.out.printf("%s_%s\n",_user.getUsername(),_user.getuserType);
    _   }
 _ _}
}

This is obviously far from being complete but_I_am completely stuck._My first problem is that "for (User user :_groupArray)" is giving me the error_illegal start of_type._Please_help me with this!!_I think my User class is_fine but my UserGroup class is_nowhere enar completing all the objectives and_I don't know how to do_them!!

A:

The specification requires a UserGroup's_list of_users to be
instantiated within the_constructor. Thus, it_should be_not be
static but_an instance variable:  
public class_UserGroup {

 _  private ArrayList<User> people;

 __ public UserGroup()_{
__ _  __people =_new_ArrayList<User>();
    }
 __ //...
}

This way, you can create multiple_UserGroup instances, each having_their_own list of users._With a static variable, this_would not be possible.
Your getUser(int) method_does not_do what_it is supposed to do and
will not compile. You are returning_the type User there instead of
a_specific User instance.
The enhanced_for loop_you_use for printing_user_names is_a free floating block of code. It_should be_inside the method printUsernames() as prescribed_by your specification.
Your User_class_will work fine, but its instance_variables should be private instead of_public.
To resolve your import issues,_put_your_User class into a package,_e.g. user, and have UserGroup import_User.UserType (the "User."_part is needed since UserType is an_inner_class within User) from this package.
package_user;
public_class User{
//...
}

package user;
import java.util.*; 
import user.User.UserType;

public_class_UserGroup{
//...
}

_Q:

xsl is generating output even_when no element is matching

An xsl_to convert an xml file is generating output even_when no input_elements are satisfying the condtiton._the_xsl_file is as below 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1