gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
package com.example.myapp2.List1; public class Product { private String name; private…
- User
package com.example.myapp_2.List_1;
public class Product { private String name; private String description; private int imageResource; private float rating;
codepublic Product(String name, String description, int imageResource, float rating) { this.name = name; this.description = description; this.imageResource = imageResource; this.rating = rating; } public Product(String name, String description, int imageResource) { this.name = name; this.description = description; this.imageResource = imageResource; this.rating = 0.0f; } public String getName() { return name; } public String getDescription() { return description; } public int getImageResource() { return imageResource; } public float getRating() { return rating; } public void setRating(float rating) { this.rating = rating; }} Добавить в класс Product поле price, которое будет хранить стоимость товара.
- Assistant
public class Product { private String name; private String description; private int imageResource; private float rating; private double price;
codepublic Product(String name, String description, int imageResource, float rating, double price) { this.name = name; this.description = description; this.imageResource = imageResource; this.rating = rating; this.price = price; } public Product(String name, String description, int imageResource, double price) { this.name = name; this.description = description; this.imageResource = imageResource; this.rating = 0.0f; this.price = price; } public String getName() { return name; } public String getDescription() { return description; } public int getImageResource() { return imageResource; } public float getRating() { return rating; } public void setRating(float rating) { this.rating = rating; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; }