没有合适的资源?快使用搜索试试~ 我知道了~
实训六:设计简单的购物车
资源推荐
资源详情
资源评论
实训六:设计简单的购物车
1. 题目
设计简单的购物车。
2. 目的
(1)掌握 JSON 的使用方法。
(2)掌握数据列表的动态生成方法。
(3)掌握 Web Storage 的使用方法。
(4)会利用所学知识设计简单的应用程序。
3. 内容
设计产品浏览页面,用户可以单击产品的“添加到购物车”链接将产品加入购
物车,同时,显示购物车。可以对购物车中的产品执行增减或删除操作。
4. 要求
(1)针对一个具体应用,设计产品列表。
(2)要动态生成产品及购物车数据列表。
(3)将购物车的数据存放在 Web Storage 中。
Design a simple shopping cart.
The purpose of this project is to (1) master the use of JSON。
(2) master the dynamic n method of data lists。(3) master the use
of Web Storage。and (4) be able to design simple ns using the
knowledge learned.
The content of this project is to design a product browsing
page where users can click on the "Add to Cart" link to add
products to the shopping cart and display the shopping cart。Users
can also perform add。subtract。or delete ns on the products in
the shopping cart.
The requirements are to (1) design a product list for a specific
n。(2) dynamically generate the product and shopping cart data
list。and (3) store the shopping cart data in Web Storage.
Here is an example of the code:
public boolean addGoodsInCart(Items item。int number) {
if (XXX(item)) {
goods.put(item。goods.get(item) + number);
else {
goods.put(item。number);
calTotalPrice()。// Recalculate the total price of the shopping
cart
return true;
public boolean removeGoodsFromCart(Items item) {
goods.remove(item);
calTotalPrice()。// Recalculate the total price of the shopping
cart
return true;
public double calTotalPrice() {
double sum = 0.0;
Set XXX()。// Get the key set
剩余11页未读,继续阅读
资源评论
liaozhen11
- 粉丝: 1
- 资源: 44
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功