Purchase Solution

Java Class for services offered by a hair-styling salon.

Not what you're looking for?

Ask Custom Question

The Curl Up and Dye Salon offers a variety of salon services for its customers. Jane Fields, the owner, has contracted to have you write a program that allows reports to be output, sorted by each type of service offered. Table below shows the various services, service prices, and service times.

Service Price($) Time(Minutes)

Cut 8.00 15
Shampoo 4.00 10
Manicure 18.00 30
Style 48.00 55
Permanent 18.00 35
Trim 6.00 5

Create a class for services offered by a hair-styling salon. Data fields include a String to hold the service description (for example, "Cut," Shampoo", or "Manicure"), a double to hold the price, and an integer to hold the average number of minutes it takes to perform the service. The class name is Service. Include a constructor that requires arguments for all three data fields and three get methods that return each one of the data field's values.

Write an application named SalonReport that contains an array to hold six Service Objects and fill it with data from the table above. Include methods to sort the array in ascending order by price of service, time it takes to perform the service, and in alphabetical order by service description.

Prompt the user for the preferred sorting method, and offer three choices: sort by description, price or time. Depending on the user's input, display the results.

Purchase this Solution

Solution Summary

Solution contains full Java program and follows the naming convention to make it easier for the reader to understand code.

Solution Preview

---------------- Service.java -----------------

import java.util.*;
public class Service implements Comparable< Service> {

private String serv;
private double price;
private int time;
public Service(String s,double p,int t)
{
serv = s;
price = p;
time = t;
}
public String get_serv_name()
{
return serv;
}

public double get_serv_price()
{
return price;
}

public int get_serv_time()
{
return time;
}

public int compareTo(Service new_ob) {

//int n_time = new_ob.get_serv_time();

//ascending order
return this.time - new_ob.get_serv_time();

//descending order
//return compareQuantity - ...

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Javscript Basics

Quiz on basics of javascript programming language.

C# variables and classes

This quiz contains questions about C# classes and variables.

Basic Networking Questions

This quiz consists of some basic networking questions.