Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch8ex2;
- public class Num
- {
- int w,o,t,h;
- Num(int num)
- {
- this.w=num;
- this.h=w/100;
- this.t=(w-(h*100))/10;
- this.o=w-(h*100)-(t*10);
- }
- public void extract(char choice)
- {
- if(choice=='w')System.out.println(this.w);
- if(choice=='o')System.out.println(this.o);
- if(choice=='t')System.out.println(this.t);
- if(choice=='h')System.out.println(this.h);
- }
- }
Add Comment
Please, Sign In to add comment