You are viewing a single comment's thread. Return to all comments →
public class Solution { public void display(String x,int y){ System.out.print(x);
for(int i = x.length(); i < 15; i++){ System.out.print(" "); } if(y<10){ System.out.println("00"+y); }else if(y<100){ System.out.println("0"+y); }else if(y<1000){ System.out.println(y); } } public static void main(String[] args) { Scanner sc=new Scanner(System.in); String s1=sc.next(); int x=sc.nextInt(); String s2=sc.next(); int y=sc.nextInt(); String s3=sc.next(); int z=sc.nextInt(); Solution l = new Solution(); System.out.println("================================"); l.display(s1,x); l.display(s2,y); l.display(s3,z); //complete this line System.out.println("================================"); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Java Output Formatting
You are viewing a single comment's thread. Return to all comments →
public class Solution { public void display(String x,int y){ System.out.print(x);
}