// LANDSCAPE GARDENING QUOTE // Frans Coenen // University of Liverpool // 18 April 2013 import java.util.*; class LandsGardQuote { // ------------------- CONSTANTS ------------------------ /** Constant for installation (labour) time (minutes) for lawn type 1 item (per m^2). */ private static double INST_TIME_LAWN = 20.0; /** Constant for installation (labour) time (minutes) for patio type 1 item (per m^2). */ private static double INST_TIME_PATIO = 20.0; /** Constant for installation (labour) time (minutes) for water feature type 2 item (per item). */ private static double INST_TIME_WATER_FEATURE = 60.0; /** Constant for labour cost. */ private static double LABOUR_COST = 16.49; // ------------------- FIELDS ------------------------ /** Instance of Scanner class (to allow keyboard input). */ private static Scanner input = new Scanner(System.in); /** Material cost (£) for lawn type 1 item (per m^2). */ private double materialCostLawn = 15.5; /** Material cost (£) for patio type 1 item (per m^2). */ private double materialCostPatio = 20.99; /** Material cost (£) for water feature type 2 item (per item). */ private double materialCostWaterFeature = 150.0; /** The current quote. */ private Quote myQuote = null; // ------------------ CONSTRUCTORS ------------------------ /* ------ None, default constructor ------ */ // --------------- METHODS TO GENERATE A NEW QUOTE (MENU OPTION 1) --------------- /** Top level method to prepare a quote. */ public void prepareAnewQuote() { // Input inputQuoteDetail(); // Calculate working costs myQuote.calculateCosts(); // Output quote details to screen outputQuoteDetailsToScreen(); } private void inputQuoteDetail() { // Input month System.out.print("Input month (For example May): "); String month = input.nextLine(); // Create quote elements (type 1 and type 2) QuoteItemType1 lawn = new QuoteItemType1("lawn",materialCostLawn,INST_TIME_LAWN); QuoteItemType1 patio = new QuoteItemType1("concrete patio",materialCostPatio,INST_TIME_PATIO); QuoteItemType2 waterFeature = new QuoteItemType2("water feature",materialCostWaterFeature, INST_TIME_WATER_FEATURE); // Create Quote myQuote = new Quote(month,lawn,patio,waterFeature,LABOUR_COST); } /** Method to output quote details to screen. */ private void outputQuoteDetailsToScreen() { System.out.println(myQuote); } }