How arrange? Pls come help...thx
i want ask is how to arrange the diferent string in sequnece?
Example:
me store in array
type[0] = new Service("Cut",8.00,15);
type[1] = new Service("Shampoo",4.00,10);
type[2] = new Service("Manicure",18.00,30);
type[3] = new Service("Style",48.00,55);
type[4] = new Service("Permament",18.00,35);
type[5] = new Service("Trim",6.00,5);
i want that output like this(String only) :
Cut
Manicure
Permament
Shampoo
Style
Trim
*If possible pls teach me how to code it...^^ thx
[575 byte] By [
Suqina] at [2007-11-27 11:20:17]

that service store all this:
String Service;
double Price;
int AvgMin;
AlignmentService align = new AlignmentService();
public Service()
{
}
public Service(String s, double p, int a)
{
Service = s;
Price = p;
AvgMin = a;
}
public void setSERVICE(String s)
{
Service = s;
}
public void setPRICE(double p)
{
Price = p;
}
public void setAVGMIN(int a)
{
AvgMin = a;
}
public String getSERVICE()
{
return Service;
}
public double getPRICE()
{
return Price;
}
public int getAVGMIN()
{
return AvgMin;
}
public String toString()
{
return getSERVICE()+"\t\t"+align.right(getPRICE(),6)+"\t\t\t"+align.a(getAVGMIN(),8);
}
Message was edited by:
Suqin
Suqina at 2007-7-29 14:41:46 >

> i want that output like this(String only) :
> *If possible pls teach me how to code it...^^ thx
just correction .. you should have type .. fix my code, not teach me...
because like that you'll be just doing the hardest part copying and pasting and then run, and the easy part was done by someone else..
show some code and where is your problem, and am ready to help...
This is my TestService.java:
import java.io.*;
class TestService
{
public static void main(String args[]) throws IOException
{
Service type[] = new Service[6];
AlignmentService align = new AlignmentService();
for (int i=0;i<type.length;i++)
{
type = new Service();
}
type[0] = new Service("Cut",8.00,15);
type[1] = new Service("Shampoo",4.00,10);
type[2] = new Service("Manicure",18.00,30);
type[3] = new Service("Style",48.00,55);
type[4] = new Service("Permament",18.00,35);
type[5] = new Service("Trim",6.00,5);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int select;
System.out.println("Print the report by :");
System.out.println("1. Service");
System.out.println("2. Price");
System.out.println("3. Time");
System.out.println("4. Exit");
System.out.print("\n");
System.out.print("Enter the selection : ");
select = Integer.parseInt(br.readLine());
if (select==1)
{
System.out.println("Service\t\t\tPrice($)\t\tTime (Minute)");
System.out.println("=======\t\t\t========\t\t=============");
// At here me stuck dont know how to contineu..^^
}
This is my Test.java:
class Service
{
String Service;
double Price;
int Min;
AlignmentService align = new AlignmentService();
public Service()
{
}
public Service(String s, double p, int a)
{
Service = s;
Price = p;
Min = a;
}
public void setSERVICE(String s)
{
Service = s;
}
public void setPRICE(double p)
{
Price = p;
}
public void setAVGMIN(int a)
{
Min = a;
}
public String getSERVICE()
{
return Service;
}
public double getPRICE()
{
return Price;
}
public int getMIN()
{
return Min;
}
public String toString()
{
return getSERVICE()+"\t\t\t"+align.right(getPRICE(),6)+"\t\t\t"+align.a(getMIN(),8);
}
}
Message was edited by:
Suqin>
Suqina at 2007-7-29 14:41:46 >
