Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.time.LocalDate;
- public class Program
- {
- public static void main(String[] args)
- {
- shop[] food = new shop[2];
- food[0] = new shop("Pomidor", 1.59,04, 03);
- food[1] = new shop("Banan", 2.39,04, 01);
- for(shop que: food)
- {
- System.out.println("Nazwa produktu = " + que.getName() + ", Cena = " + que.getPrice() + ", Data produkcji = " + que.getDay());
- }
- }
- }
- class shop
- {
- private String name;
- private double price;
- private LocalDate date;
- public shop(String class_name, double class_price, int month, int day)
- {
- name = class_name;
- price = class_price;
- date = LocalDate.of(month, day);
- }
- public String getName()
- {
- return name;
- }
- public double getPrice()
- {
- return price;
- }
- public LocalDate getDay()
- {
- return date;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement