/* This program demonstrates a class in a package that can be imported and used in another class. * We only add tge basic class fuctionalities, like constructors, accessors and mutators and a print method. * We don't need a main method because execution will not start in this class. * We can write a main method if we want this class to function on its own. This won't affect other classes that use this. */ package food; // This line should be the first non comment line of the program // This class must be put inside a folder called "food" import java.util.Scanner; public class Chips //class should be public to be importable { // A class for a potato chip String flavor; String type; double price; //constructors public Chips() { flavor = "original"; type = "original"; price = 3.79; } public Chips(String f, String t, double p) { flavor = f; type = t; price = p; } //accessors public String getFlavor() { return flavor; } public String getType() { return type; } public double getPrice() { return price; } //mutators public void setFlavor(String f) { flavor =f; } public void setType(String t) { type =t; } public void setPrice(double p) { price =p; } //simple print method public void print() { System.out.println("Flavor = " + getFlavor() + "\nType = "+ getType() + "\nPrice = $ " + getPrice()); } }