Java Program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • copelane
    New Member
    • Apr 2008
    • 2

    Java Program

    I need some java programming help from someone to fix the SalonReport below:





    [CODE=java]import java.util.Scann er;
    import java.util.Array s;

    public class SalonReport {

    public static void main(String[] args) {

    int choice;
    Scanner sc = new Scanner(System. in);
    Service[] services = new Service[5];

    services[0] = new Service("Cut", 8.00, 15);
    services[1] = new Service("Shampo o",4, 10);
    services[2] = new Service("Manicu re",18,30);
    services[3] = new Service("Style" ,48,55);
    services[4] = new Service("Perman ent",18,35);
    services[5] = new Service("Trim", 6,5);

    System.out.prin tln("Enter how you would like the services sorted (1) Description (2) Price (3) Time: ");
    choice = sc.nextInt;

    //if choice = 1 then sort by description...
    //if choice = 2 then sort by price....
    //if choice = 3 then sort by Time...




    }
    }



    public class Service {

    String description;
    double price;
    int minutes;

    public Service(String d, double p, int m) {

    description = d;
    price = p;
    minutes = m;

    }

    public String getDescription( ) {

    return description;

    }

    public double getPrice() {

    return price;

    }

    public int getMinutes() {

    return minutes;

    }
    }[/CODE]
    Last edited by acoder; Apr 8 '08, 11:54 AM. Reason: Added code tags
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    Originally posted by copelane
    I need some java programming help from someone to fix the SalonReport below:
    [CODE=java]
    import java.util.Scann er;
    import java.util.Array s;

    public class SalonReport {

    public static void main(String[] args) {

    int choice;
    Scanner sc = new Scanner(System. in);
    Service[] services = new Service[5];

    services[0] = new Service("Cut", 8.00, 15);
    services[1] = new Service("Shampo o",4, 10);
    services[2] = new Service("Manicu re",18,30);
    services[3] = new Service("Style" ,48,55);
    services[4] = new Service("Perman ent",18,35);
    services[5] = new Service("Trim", 6,5);

    System.out.prin tln("Enter how you would like the services sorted (1) Description (2) Price (3) Time: ");
    choice = sc.nextInt;

    //if choice = 1 then sort by description...
    //if choice = 2 then sort by price....
    //if choice = 3 then sort by Time...




    }
    }



    public class Service {

    String description;
    double price;
    int minutes;

    public Service(String d, double p, int m) {

    description = d;
    price = p;
    minutes = m;

    }

    public String getDescription( ) {

    return description;

    }

    public double getPrice() {

    return price;

    }

    public int getMinutes() {

    return minutes;

    }
    }[/CODE] (end of Quote - not in quote tags because of tag bug)

    First of all: Wrong section. You want the Java Forum.
    Secondly: Please state, what exactly your problem is. What should the program do? What does it do? Are there any errors given? If so, what are these errors?
    Last, but not least: Please use CODE tags, when posting code. As you see above, it makes code so much easier to read.

    Greetings,
    Nepomuk

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Moved to the Java forum where you've got more chance of getting help with your problem than the Editor's Corner.

      Moderator.

      Comment

      • sukatoa
        Contributor
        • Nov 2007
        • 539

        #4
        Yes, what is your question? :)

        Comment

        Working...