/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package sam; import java.util.Scanner; import javafx.scene.paint.Color; /** * * @author mohit */ public class Donut extends TimsProduct { private String description; private int calorieCount; private Donut(String name, String description, double cost, double price, int calorieCount) { super(name, cost, price); this.description = description; this.calorieCount = calorieCount; } public static Donut create() { Scanner sc = new Scanner(System.in); System.out.println("Enter the Name: "); String name = sc.nextLine(); System.out.println("Enter Description: "); String description = sc.nextLine(); System.out.println("Enter tne cost: "); double cost = sc.nextDouble(); System.out.println("Enter the Price: "); double price = sc.nextDouble(); System.out.println("Calorie Count is: "); int calorieCount = sc.nextInt(); Donut chocolatedonut = new Donut(name, description, cost, price, calorieCount); return chocolatedonut; } public String getDesciption() { return description; } public int getCalorieCount() { return calorieCount; } public String getConsumptionMethod() { return ("Eat it."); } public String toString(){ return ("Description is: " + description + "Calories are: " + calorieCount); } }