그래서 고객이 제품을 구입하여 장바구니에 추가 할 수있는 웹 사이트를 시뮬레이트하는 프로그래밍 클래스의 코드를 작성하고 있습니다. 나는 Product and Cart 클래스를 만들었습니다. 둘 다 일부 디렉토리에 있으며 .class 파일은 동일한 패키지에 있습니다. 그렇다면 장바구니 클래스를 컴파일 할 때 제품에서 "기호를 찾을 수 없습니다"라는 메시지가 나타나는 이유는 무엇입니까? 도움말 plz! 와 타이"기호를 찾을 수 없습니다"이유는 무엇입니까?
Cart 클래스 :
package com.DownloadThis;
import java.util.ArrayList;
public class Cart {
private ArrayList<Product> myCart;
public Cart() {
myCart = new ArrayList<Product>();
}
public void addProduct(Product p) {
myCart.add(p);
}
public float getTotal() {
float totalPrice = 0;
for(int i = 0; i < myCart.size(); i++) {
Object obj = myCart.get(i);
Product p = (Product)obj;
totalPrice = totalPrice + p.getPrice();
}
return totalPrice;
}
public void addToCart(int product_id) {
}
}
제품 클래스 :
package com.DownloadThis;
import java.sql.*;
public class Product {
private String artist;
private String album;
private int year;
private String genre;
private float price;
private String albumart;
private String username;
private String password;
private Connection connection = null;
private ResultSet rs = null;
private Statement st = null;
public Product() {
}
public Product(String artist, String album, int year, String genre, float price, String albumart) {
this.artist = artist;
this.album = album;
this.year = year;
this.genre = genre;
this.price = price;
this.albumart = albumart;
}
public String getArtist() {
return this.artist;
}
public void setArtist(String artist) {
this.artist = artist;
}
public String getAlbum() {
return this.album;
}
public void setAlbum(String album) {
this.album = album;
}
public int getYear() {
return this.year;
}
public void setYear(int year) {
this.year = year;
}
public String getGenre() {
return this.genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
public float getPrice() {
return this.price;
}
public void setPrice(float price) {
this.price = price;
}
public String getAlbumart() {
return this.albumart;
}
public void setFilename(String albumart) {
this.albumart = albumart;
}
}
전체 오류를 게시 할 수 있습니까? – kosa
... 정확히 생산하는 라인과 함께 – Vlad
커맨드 라인에서 컴파일 중입니까? 일식? – thatidiotguy