gpt-4-0314· OpenAI
WildChat-4.8M (AI2)
public enum PizzaSize { Small(6.79), Medium(8.29), Large(9.49), ExtraLarge(10.29),…
- User
public enum PizzaSize { Small(6.79), Medium(8.29), Large(9.49), ExtraLarge(10.29), Fete(15.99);
private final double price; private PizzaSize(double price) { this.price = price; } public double getPrice() { return price; } static PizzaSize getSelectedItem() { // TODO Auto-generated method stub return null; }}
- Assistant
Here's an example of how to use the PizzaSize enum:
public class PizzaShop { public static void main(String[] args) { PizzaSize myPizzaSize = PizzaSize.Large; System.out.println("You have ordered a " + myPizzaSize.name() + " pizza."); System.out.println("The price of your pizza is $" + myPizzaSize.getPrice()); } }This will output:
You have ordered a Large pizza. The price of your pizza is $9.49.In this example, the
PizzaSizeof the ordered pizza is set toLarge, and you can access its size and price usingmyPizzaSize.name()andmyPizzaSize.getPrice()respectively. You can replaceLargewith any other size in the enum (Small, Medium, ExtraLarge, or Fete).
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.