Tesis 1.0.0
Loading...
Searching...
No Matches
Carrito.java
Go to the documentation of this file.
1package com.example.food_front.models;
2
3public class Carrito {
4 private int idCarrito;
5 private String producto;
6 private int cantidad;
7 private double precio;
8 private String imageURL;
9
10 // Constructor
11 public Carrito(int idCarrito, String producto, int cantidad, double precio, String imageURL) {
12 this.idCarrito = idCarrito;
13 this.producto = producto;
14 this.cantidad = cantidad;
15 this.precio = precio * cantidad;
16 // Verifica si la URL de la imagen es null y maneja esto adecuadamente
17 this.imageURL = (imageURL != null) ? imageURL : ""; // Asignar una cadena vacía si es null
18 }
19
20 // Método para obtener el ID
21 public int getIdCarrito() {
22 return idCarrito; // Este es el método que necesitas
23 }
24
25 // Getters
26 public String getProducto() {
27 return producto;
28 }
29
30 public int getCantidad() {
31 return cantidad;
32 }
33
34 public double getPrecio() {
35 return precio;
36 }
37
38 public String getImagenUrl() {
39 return imageURL;
40 }
41
42}
Carrito(int idCarrito, String producto, int cantidad, double precio, String imageURL)
Definition Carrito.java:11