Explore BrainMass

CustomerType enum and CustomerTypeApp class using NetBean 7.2


1. CustomerType enumeration contains constants representing 3 customer types: retail, trade and college
2. CustomerType contains getDiscount method that returns the appropriate discount for each customer type: 10% for retail, 30% for trade and 20% for college
3. CustomerType enumeration contains a toString method returning an appropriate string for each customer type: Retail customer, Trade customer and College customer
4. Contains CustomerTypeApp class that compiles correctly
5. CustomerTypeApp main method declares a CustomerType variable
6. CustomerTypeApp main method assigns valid customer type to its CustomerType variable
7. CustomerTypeApp main method displays the discount for its CustomerType variable
8. CustomerTypeApp main method displays the string for its CustomerType variable

public class CustomerTypeApp
public static void main(String[] args)
// display a welcome message
System.out.println("Welcome to the Customer Type Test applicationn");

// get and display the discount percent for a customer type

// display the value of the toString method of a customer type


// a method that accepts a CustomerType enumeration

Solution Preview

There are two files in the zip file. one for CustomerType enum and the other for CustomerTypeApp class.

public enum CustomerType {

RETAIL("Retail customer", 0.1), //10% for retail
TRADE("Trade customer", 0.3), //30% for trade
COLLEGE("College customer", 0.2);//20% for college

private String custType;
private double discount;

private CustomerType(String s, double d) {
custType = s;

Solution Summary

The expert examines CustomerType enum and CustomerTypeApp class using NetBean 7.2.